Hi,
Is there a way to monitor the Pisound’s 6.35 mm input jack via headphones plugged into the 6.35 mm output jack while simultaneously writing to the local Raspberry Pi’s microSD card?
We can do each individually, but not both simultaneously…
We’ve successfully got a hydrophone (underwater microphone) plugged into (and powered by) the Pisound 6.35 mm input jack. I can monitor the signal as I adjust the input gain by plugging headphones into the Pisound 6.35 mm output jack after issuing this command:
arecord -f S16_LE -r 48000 -D hw:1,0 -c 2 | aplay -D hw:1,0 -c 2
Once the gain is set, I kill the arecord-aplay process and then begin writing the signal to the microSD card (e.g. in HLS = HTTP Live Streaming format) using something like the following ffmpeg command:
ffmpeg -f alsa -ac 2 -ar 48000 -i hw:1,0 -f segment -segment_list "/tmp/hls/live.m3u8" -segment_list_flags +live -segment_time 10 -segment_format mpegts -ar 4800 -ac 2 -acodec aac "/tmp/hls/live%03d.ts"
(That’s slightly simplified, but gives you an idea of how we’re using ffmpeg to read from the write audio card,device. You can see all the streaming code in our Orcasound orcanode Github repository.)
Thanks in advance! Any solution for sharing/splitting/teeing the input from a hardware device would be welcome, whether it’s a Linux audio trick or a way of using ffmpeg (or any other opensource software) that we’ve not yet discovered.
If we could monitor while writing it would really help us in two ways:
- we could adjust levels without interrupting the continuous recording/streaming we’re trying to do, and
- we could play ocean sounds locally (e.g. in an aquarium or museum) while simultaneously streaming the sounds to our live-listening web app – live.orcasound.net
Thanks in advance for any guidance you can offer us,
Scott in Seattle (WA, USA)