Issues with audio recording

Hello,
This month I just received Zynthian v4 and I am really impressed with performance improvement comparing it to my custom headless build on Rpi 3 b :smiley:
There were some issues which are probably fixed in Staging-2104, I need to check this later.
But there is one more thing that is probably broken in both:
In all my audio recordings on USB flash drive that are longer than 30 seconds, after about that time audio is distorted till the end of recording. Sometimes recording is also called #NO-jack_capture.wav instead of selected layer. This happens both for Synth Engines and Audio FX layers recording.
I havenā€™t noticed anything problematic during recording, as sound from audio outputs (and Rpi headphone outputs) was fine all the time. I discovered this during recording playback on Zynthian and my phone.
Some thing that may be related:

  1. Recording is not available instantly after I click ā€œstop recordingā€, and time indicator stucks on 0:00 for even few minutes. Is it normal? Is there some postprocessing going on then?
  2. On first boot of Zynthian stable image red ā€œErrorā€ appears on boot splash. On later boots starting screen is fine.

How can I investigatet this more: is there any way to enable writing logs on USB by default, as I do not want to flood my sdcard with them?

Maybe this is problem with my hardware? Or flash memory? Has somebody tried recording audio fx layers, and havenā€™t got any problems?

If your recording is long (>10/20 minutes), or your USB is slow, then itā€™s completely normal.

This is normal too. On first boot, error screen is generated and displayed for a while.

This is not normal. Could you send some recording with this problem?

Thanks

All test recording were shorter than 3 minutes. They are being processed each time about 1 to few minutes on USB and few seconds on SD.
Recordings saved on sd-card are fine.

Example recorded from external source (digital piano) https://drive.google.com/file/d/1Q9_Co542msuswwvgCMKqnuQ4DoQyzyOM

I tested two different USB3 flash drives with the same results.

One additional line in log, that I have found:
May 06 11:57:52 zynthian startx[5612]: Terminal type unknownā€™ is not defined. `

Today I had some more time, and tried to run jack_capture in console with -V param.
It may be that default buffer is too small in my case or there is some other issue.
Iā€™ve increasing min buffer to 6, 8, 12, and even 20 seconds but with no success.
Currently after about 1:40 minutes problem appears each time during recording.
Time is increasing, so maybe I should be more optimisticā€¦

Log output from command /usr/local/bin/jack_capture -V 001-test.wav:

Overruns: 2315  Xruns: 0
jack_capture failed writing 256 frames. Some parts of the recording will contain silence..                                                       |: 0
    Try a bigger buffer than -B 4.000000

Iā€™ve found out that similar problems appeared in past, but in my case this happens only in last part of my records: Recording "clips" and "crops" on Raspberry Pi, writing to Pendrive / SD-card Ā· Issue #26 Ā· kmatheussen/jack_capture Ā· GitHub

It really seems like a slooow device. Have you tried to record to the SD card? Itā€™s not recommended, but normally it works fine while you donā€™t unplug the power.

Regards,

For few minutes records it seems fine when I do not plug in flash drive, and it is indeed really fast.
Could you give me examples of reference fast devices? My both flash drives supposed to work with USB 3.0, but they old a bit, so it might be the case.

My real life scenario is, that I want to record my band practice (which are not so smooth - one take is about 15 minutes of 3-5 minute song, with pauses and interruptions). This records donā€™t need to be played back immadietly so it may be processed longer.
My alternative is the old solution: notebook with audio interface, which is just not as handy, as Zynthian :wink:

What is the main bottleneck here that demands high write speed? Is it jack_capture, Raspberry itself, or something other?
And another question if I canā€™t do anything with storing on USB: what are risks of writing records to sdcard.
Will it be safe for me to save few 15-minutes recordings?

Disk writing:

jack_capture failed writing 256 frames. 

Is it your drive eating too much power from the RBPi? Is your drive a Solid State Device?

If the power fails during recording, you could end with a corrupted SD image. Sometimes itā€™s recoverable, sometimes not. :wink:

I see no problem while the power doesnā€™t fail. You could use a big power-bank ā€¦

Regards,

1 Like

Probably not much power, itā€™s just regular USB pendrive, not SSD.
What should be stable USB write speed for audio recorder then? Could you give me examples of some reference devices that should have better performance?
Maybe itā€™s time for me to buy new USB stick :confused:

OK. So Iā€™ve just tested audio recording on a brand new USB flash drive and problems not occurred.
One thing closed.

Since we know the issue, I think that it should be addressed somehow.
Currently I have two ideas:

  • There should be some information for Zynthian user that recorded audio was corrupted and it should be clearly stated that slow USB flash drives may cause such problems somewhere on a wiki.
    Minimum acceptable solution will be just log errors from jack_capture in UI log, and best will be to popup this information in GUI (currently it seems there are no such notification implemented).
  • We can make use RAM (RPi4 has a lot of free MB, even GB) to write recordings to temp location on RAM disk and then copy it to USB/sdcard. It should be also configurable in webconf whether RAM disk should be used for audio recording.

First solution is quite easy to implement, and I may try to make PR next month.
But second may be also beneficial for some other features, for example:

1 Like

@multim thanks for the feedback. It would certainly be advantageous to improve the audio recording and playback and as you have observed there has been some discussion. We may find the most effective solution is to implement our own audio recorder and include the various suggestions including indicating errors.

May I suggest you raise tickets in the issue tracker for these requests? I can see there could be a feature that indicates various errors and offers access to an error log. Improvements in audio recording may be a separate request, etc.

I would love to find the time to port my multitrack audio recording code I started a few years back to Zynthian but am very aware of the constraints on my time. Maybe it might pop out sometime :grinning_face_with_smiling_eyes:.

1 Like