Audio Loopback Recording with PulseAudio


Pulseaudio provides us with the means to easily create an audio loopback device that allows us to record sounds produced by our system as if they were being redirected into the microphone. This could be useful for screen recording sessions where you want to capture the audio as it is produced instead of just setting an external microphone next to your speaker.


One method you can use to accomplish this is to ?install and use the software package pavucontrol, which is available in the Debian repositories, by executing:

# apt-get install pavucontrol

Once pavucontrol is installed you can use it to change a variety of options regarding your sound, more-so than the default sound manager in most desktop environments. You'll notice at the top of the window several tabs. The tab we're interested in is the "Recording" tab. In the "Recording" tab, you will see a list of all applications currently listening for audio input. Remember the application has to be actively recording audio input, so if you're using something like gtk-recordmydesktop , it must be actively capturing your screen to appear here. If your application is actively recording, but does not appear in the recording tab of pavucontrol, then it is not using pulseaudio for this purpose. In the capture settings for your application, enter the audio capture device as "pulse".


After you've verified that your recording software is indeed listening for input using pulseaudio and it appears in the recording tab of pavucontrol, we can now change where it listens for input. Make sure your software volume output (the volume level in pavucontrol, not the volume knob on your external speakers) is set to 100%, but not more than that in order to avoid distortion. You can set it lower if you want, but the volume at which audio is played by your system is the volume at which it will be recorded. You'll notice that there's a button next to each application that displays the device it is listening on for audio input. You can click this button and change it to any audio device you wish such as a different microphone. One of those options will read, "Monitor of <Internal Sound Card>". If you select this "Monitor" as your audio input device, that application will no longer record audio from microphones, but will capture any audio sent to your sound card. This does not interrupt audio played by pulseaudio, it just records it as if it were also an input device.