D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] Simultaneously recording from multiple sources using Pulse Audio

 

Ok, so I'm trying to get my phone to record from 2 audio sources
simulatneously - the audio output and the mic input.

I have the following rough-and-ready script:
#!/opt/bin/bash
str_STARTTIME=`date +%F\@%k-%M-%S`
echo $str_STARTTIME
str_SAVEDIR="/media/internal/downloads/music/VoiceRecordings"
echo $str_SAVEDIR
str_MICFILE=$str_SAVEDIR/$str_STARTTIME.mic.wav
echo $str_MICFILE
str_SPKFILE=$str_SAVEDIR/$str_STARTTIME.spk.wav
echo $str_SPKFILE

parec --format=s16le --rate=44100 --channels=1 | sox --type raw -s2L --rate 44100 
--channels 1 - --type wav $str_MICFILE &
parec --format=s16le --rate=44100 --channels=1 --device=pcm_output.monitor | sox 
--type raw -s2L --rate 44100 --channels 1 - --type wav $str_SPKFILE &

count=0
while : ; do
        echo count = $count
        ((count=count+1))
        read -t 10 && killall parec && break
done
echo exited while loop
exit 0
## END OF SCRIPT

It does indeed create the two files in the correct place with the correct, however 
only the $str_MICFILE file actually has any content.  I'm presuming this is because 
it was the first instance of parec to be launched.

So, does anyone know of a way to either record from 2 pulseaudio sources, or create 
a virtual pulseaudio device that will let me record both streams simultaneously?

Cheers.
Grant. :)

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html