1

My goal is to have a command line tool to record long multichannels wav files on a raspberry pi 3 (5 hours +, 18 channels). Audio interface is the Behringer XR18.

The way to do this is of course via arecord, which sadly produces buffer overruns on the pi. As arecord has a fixed max. buffer size of 500ms, that I can't/don't want to change, I pipe the output of arecord to sox, which in turn writes to a ntfs USB flash drive. As an added benefit sox converts the samples from 32 to 24 bit on the fly and does away with overruns (as far as I can see).

Here is the command I run:

arecord -M -D hw:CARD=X18XR18,DEV=0 -c18 -f S32_FE -r48000 | sox --input-buffer 51200 -t wav - -b24 -c18 -t wav <filename.wav>

The first part up to the pipe |works, no help needed there. The second part also works, the file gets created and grows, as the recording progresses. But for some reason at about 1,5GB the recording stops and sox exits.

Running arecord alone doesn't have this restriction, it runs for hours upon hours (with overruns of course).

I noticed that, shortly before reaching the final file size, the file stops growing continually but rather holds for quite some time and then grows in chunks of a few MB. That sounds terribly like a buffer overrun to me, but doubling the buffer size of sox to 100 MB has made no difference whatsoever. The output of sox isn't very helpful either, even at verbose level 3 it only shows:

sox WARN sox: '<filename>' output clipped 13403 samples; decrease volume?
sox WARN sox: '-' balancing clipped 13403 samples; decrease volume?

What I've tried so far:

  • Changed the --input-buffer-size of sox - no difference
  • tried to start a new file just before 1,5GB - works, but as soon as the added filesize reaches 1,5GB it stops again
  • recorded straight to the SD card instead of flash drive - no difference (apart from introducing overruns)

I don't have a different linux machine to test it on atm, but the raspberry pi 3 should be absolutly capable of handling this task (cpu/ram-wise). Does anyone have a hint as to what might be causing this strange behavior?

0

This thread says to try using an xfs-formatted target disk/SD-card.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.