Ian Ward's email:
first name at this domain
wardi on OFTC, freenode and github
I set up a VM to present software to a client remotely, but I needed a way to record both the audio in and out so that I could capture both my presentation and the client's questions. In the past I've used some ALSA configuration magic for audio things advanced enough that they don't have a friendly GUI, but since Pulse Audio is the shiny new thing I decided to go that route.
It turns out to be fairly simple. I create a new null sink (think: fake sound card for output) and attach a loopback from the audio out monitor of the "real" sound card and another from the the audio in of the "real" sound card:
pactl load-module module-null-sink sink_name=bothsides pactl load-module module-loopback latency_msec=5 sink=bothsides \ source=alsa_output.pci-0000_00_04.0.analog-stereo.monitor pactl load-module module-loopback latency_msec=5 sink=bothsides
alsa_output... source comes from running
pactl list and copying the device name. The second loopback automatically uses the only
alsa_input... source device. Then I can record from the monitor of this null sink with a command like:
pacat --record -d 2 | sox -t raw -r 44100 -s -L -b 16 -c2 - "recording.wav"
-d 2 option selects the new null sink monitor device I created (the index may be different in your case). Last, you may want to use the
pavucontrol program to adjust the levels for the input and output so you don't end up with one sounding much louder than the other in the combined recording.