In order to do this, we'll have to configure PulseAudio, Ubuntu's audio subsystem.
Note: All the screenshots here were taken with Ubuntu 10.04, but these instructions should work with every GNU/Linux system using the PulseAudio subsystem.
What we're going to do
When we record our voice, the web recorder grabs the audio from an Input Channel, in this case the microphone. Likewise, as we explained in the previous tutorial, we can also grab another channel, like the Audio Output, to record the audio that comes out from the speakers.
So, our mission is to mix these two channels (microphone and audio output) into a single one, so we can record from this new, unified channel.
System setup
As a one time process, we need to create a "virtual output" that will contain the mixed audio.
We can do this on a shell with the following commands:
$ pactl load-module module-null-sink
$ pactl load-module module-loopback
$ pactl load-module module-loopback
That's right. We create a "null sink" (the virtual output) and two loopback connectors (one for the microphone, and the other one for the audio output).
Since we don't want to type those commands every time we broadcast in Flipzu, we can edit the "/etc/pulse/default.pa" file and append the following lines to the end. We open up the editor as root:
$ sudo nano /etc/pulse/default.pa
and we add:
load-module module-null-sink
load-module module-loopback
load-module module-loopback
That's it. On some systems PulseAudio will reload automatically, but I recommend rebooting the system, to make sure everything keeps working properly.
Channels setup
In order to make advanced configurations in PulseAudio, we need to install the "pavucontrol" tool first. You can find it in the "Ubuntu Software Center", or install it from the command line, as you wish.
Once the software is installed, we start the PulseAudio Volume Control application (it's in the Sound and Video menu), and we start mixing the channels.
In the "Playback" tab, we show "All Streams" (bottom right corner) and we redirect the loopbacks we created at the beginning to the Null Output:
Then, we switch to the "Recording" tab, we select "All Streams" in the bottom-right drop down menu, and we'll see, again, both loopback devices. We keep one from "Analog Stereo Internal Audio" (the microphone) and set the other one from "Analog Stereo Internal Audio Monitor" (the audio output). And that's it.
We go to http://flipzu.com/bcast and start the web recorder. After we do this, we'll see the ALSA Plugin appear in the PulseAudio Volume Control. This is our web recorder:

And, as you see in the screenshot, we configure the ALSA plug-in to grab the audio from the "Null Output Monitor", which is our channel containing both microphone and audio output.
Finally, it's time to test it out! Play some music in your PC, or say something, and you should see the Volume Meter in the recorder move accordingly:

Final Tips
If your tests succeeded, now you're ready to do some serious broadcasting. Don't forget to take a look at the "Input Devices" tab in the PulseAudio Volume Control, in order to adjust the volume of your microphone or audio output so they match properly. This settings vary from system to system, so you will probably have to play with these a little bit.
Have fun!


Gracias, por el tutorial! en ubuntu bien voy a probarlo con Debian
ReplyDeleteHello,
ReplyDeleteWould there be a way to hard code the configuration done on the pavucontrol side so that we dont have to do it every time we reboot?
Hi,
ReplyDeletePavucontrol is a front end for the PulseAudio mixer, so I guess that something must be overwriting your mixer settings when you shut down.
Maybe you can find some tips/pointers/workarounds here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=556971
Hope it helps,
Dario.-
Hello
ReplyDeletewould there be a way to have the music playing going both into the virtual mic and my headphones? so that i know what i'm playing at least :]
Big thanks! I have been looking for a tutorial like this for 2 days! You've done a REALLY good job on this. I can't even explain how thankful I am. Works great!
ReplyDeleteI would love to win it!! What do I have to do? just comment here? thanks for the giveway is really what I was looking for!
ReplyDeleteThanks for the sharing of such information we will pass it on to our readers
Thank you so much. Everything works like a charm in Ubuntu 12.10!
ReplyDelete