On a Banana Pi Pro (spinoff of an older Raspberry Pi, with an Allwinner A20 SoC and tons of on-chip peripherals), I used
arecord to capture each mic individually during a live sound gig:
#!/bin/sh REC_PATH=/home/audiohub/Recordings # When the hard drive is mounted correctly, it blocks this locally-stored file if [ -e "$REC_PATH/No Hard Drive Attached.txt" ] # -e for file exists then echo No Hard Drive. Not recording. exit 1 fi # Figure out where to record to COUNT=1 while [ -d "$REC_PATH/$COUNT" ] # -d for directory exists do COUNT=$(($COUNT+1)) done REC_PATH="$REC_PATH/$COUNT" mkdir "$REC_PATH" # Start recording echo Recording to "$REC_PATH" arecord --device=hw:CARD=X18XR18,DEV=0 --channels=18 --file-type=wav --format=S32_LE --rate=48000 --buffer-time=20000000 --max-file-time 300 "$REC_PATH/all_tracks.wav" & # Force a filesystem sync every 1 second to keep the buffer small enough to write without missing samples COUNT=1 while true do sleep 1 echo sync $COUNT sync COUNT=$(($COUNT+1)) done
This works, but it gives me an 18-track WAV file that has to be split at regular intervals to keep the file size within spec. (every 5 minutes per above, resulting in ~1GB per file...for a 4-hour show)
Thanks to this answer, I can post-process the mass of short 18-track files into the 18 full-length single-track files that I really want, but it leaves a slight pop at each splice. I'm guessing that since I'm working entirely with uncompressed data (no compression artifacts to mess up the first and last few milliseconds), the pop comes from
arecord dropping samples while it closes one file and opens another.
Is there a tool that can record all 18 tracks seamlessly and continuously until killed (probably by
shutdown now from an unrelated script), and end up with 18 full-length single-track WAV's on a second machine?
There are several ways that this could happen:
Record the 18 WAV's directly and simultaneously, each receiving a mono stream from a different input channel of the same sound card. Then transfer the files directly to the other machine.
Record to an intermediate, convertible format of any kind, then transfer to the other machine for conversion, or convert in-transit.
Like #2, but completely take over the recording drive so as to use a specialized filesystem (if you can even call it that). A different sound system that I work with has a dedicated rack-mounted hard drive recorder that uses this method and converts in-transit via FTP. Unfortunately, the portable system that I'm building can't afford something that big, hence the Pi and this software request.
A few requirements:
If it requires a format conversion, allow that conversion to be on the destination machine or in-transit. Most of the time, the transfer will be overnight after a full day's worth of recording, and my priority in the moment is to free up some drive space for the next day. I'll have plenty of time later to do any conversions, but right now I just need to dump the drive.
Either the software itself or the script that calls it needs to figure out automatically how to make a new recording without clobbering any old ones. (there's no real-time clock and no internet on the recording machine, so the system date/time is useless) Let them pile up for a while, then transfer all or at least a bunch of them in one sitting. You can see above how I did it with
arecord, but I'm not married to that method.
It needs to get along with
mpd, which uses the playback channels of the same card.
It needs to choose the correct card, not the other one that's used by a live streaming daemon. This would probably require a command-line flag like
It would also be nice to avoid the forever loop of explicit 1-second
syncs at the end of my script.
I hope I'm not looking for a purple squirrel here.