I am a bit of a gadget freak ... I like to buy really cheap gadgets and see how they play with Linux. As a consequence I have various devices through which audio is sent, and I find Pulse Audio the ideal means of controlling and playing with sound streams etc.
I recently resurrected a USB Telbox for instance, and now have it working again - the first time since moving to KDE4.
This device is an ATA which has an input for a land line and a USB connection to the PC.
Calls from Skype - through USB - and the landline are routed to a phone handset plugged into the device.
In fact I have replaced the landline with a SIP VOIP line, so now have both SIP and Skype available on the one phone handset.
Anyway, while playing with this, I wondered about recording calls .... yes I know this is not legal without notification to the other party in some locales.
I set about attempting this today using PA .... and had success.
This post is not really about the above ramble, but more about what follows ....... how I set up PA to record not only one sound stream but a combination of two streams, into the one file.
Note that I only used two streams, but PA is not limited to two ..... have fun and record as many streams as you have devices .... all into the one sound file

***
To combine sound streams, first we create a virtual sound sink (a sink could be speakers or any other device which accepts the sound stream).
This virtual sink is where we will send our combined sound stream.
Next we create a loopback device for each of the streams we wish to include .... in this case two.
After the loopback devices are created, we assign a stream to each .... in my case above it would be the phone MIC to one and the phone Earpiece to the other.
So now we have both sound streams assigned to loopback devices which in turn are linked to the Null Sink.
While a call is in progress, we launch our favourite recording application ..... I mostly use gnome-recorder from the gnome-media package.
Start the application, and in the PulseAudio Volume Control Recording Tab, set the application to record from Monitor of Null Sink
The resulting audio file will have both sound streams mixed together.
For best results you will likely have to alter the relative sound volumes of the two streams to get the best recording.
That's it!
When using Pulse Audio Control please ensure that on each tab (at the bottom) is
show: All --- Streams/Output Devices/Input Devices/whatever is applicable to each tab.Oh yeah .... the commands to achieve this ......
To set up the Null Sink use the following command
pactl load-module module-null-sink sink_name=<any name you wish>[user@XPS ~]$ pactl load-module module-null-sink sink_name=MySink
31
[user@XPS ~]$This will return an ID number ..... something like 23 maybe, or in the above case 31
If you check you will also see a new entry in the Output Devices Tab of PA Vol Control called Null Output, as well as a new entry on the Input Devices Tab called Monitor of Null Output.
Your new Null Sink is set up!
The next command creates a loopback device, so I use it twice for the two I want
pactl load-module module-loopback sink=<previously chosen name>[user@XPS ~]$ pactl load-module module-loopback sink=MySink
32
[user@XPS ~]$ pactl load-module module-loopback sink=MySink
33
[user@XPS ~]$On the recording tab there are now two new Loopback Devices ...... and a button to select to decide what stream they should connect to.
I connect one to "Monitor of VOIP Phone Analogue Mono" and the other to "VOIP Phone Analogue Mono". The first being the earpiece and the second the MIC.
The loopback devices are now set up and ready for use.
When your preferred app is launched to record, it will also appear on the Recording Tab with a selection button, from where you choose to record from Monitor of Null Sink.
To clean up after play, it might be nice to delete the temporary sink and loopback devices. To do this use the following command
pactl unload-module <id number>In my case it was the following
[user@XPS ~]$ pactl unload-module 31
[user@XPS ~]$ pactl unload-module 32
[user@XPS ~]$ pactl unload-module 33
[user@XPS ~]$So the terminal I used looks like this after I was finished
user@XPS ~]$ pactl load-module module-null-sink sink_name=MySink
31
[user@XPS ~]$ pactl load-module module-loopback sink=MySink
32
[user@XPS ~]$ pactl load-module module-loopback sink=MySink
33
[user@XPS ~]$ pactl unload-module 31
[user@XPS ~]$ pactl unload-module 32
[user@XPS ~]$ pactl unload-module 33
[user@XPS ~]$The above is of course just a brief visit to this subject, and shows a temporary method of creating sinks and loopback devices and deleting them again after use.
You can if you wish, by editing a config file, make them permanent and available at all times, should you have the need.
OK, that enough writing for now.
Go play!