PulseAudio: Monitoring your Line-In Interface
At home, my setup consists of three machines - a laptop, a PC, and an XBOX 360. The latter two share a set of speakers, but I hate having to climb under the desk to switch the cables around, and wanted a better way to switch them back and forth. My good friend Tyler B suggested that I run the line out from the XBOX into the line-in on my sound card, and just let my computer handle the audio in the same way that it handles music and movies. In theory, this works great. In practice, I had one hell of a time figuring out how to force the GNOME sound manager applet into doing my bidding.
After quite a bit of googling, I found the answer on the Ubuntu forums. It turns out that the secret lies in a pulse audio module that isn’t enabled by default. Open up a terminal and use the following commands to permanently enable this behaviour. As always, make sure that you understand what’s up before running random commands that you find on the internet as root:
pactl load-module module-loopback sudo sh -c ' echo "load-module module-loopback" >> /etc/pulse/default.pa '
The first line instructs PulseAudio (one of the many ways that your system talks with the underlying sound hardware) to load a module called loopback, which unsurprisingly, loops incoming audio back through your outputs. This means that you can hear everything that comes into your line-in port in real time. Note that this behaviour does not extend to your microphone input by design. The second line simply tells PulseAudio to load this module whenever the system starts.
Now if you’ll excuse me, I have jerks to run over in GTA…
On my PC, I am running Ubuntu 10.04
Check out my profile for more information.

Thx.
That was exactly the thing i was missing.
Works like a charm.
@komposita – Glad to hear that I could help you out.
Hi, I also tried this and it worked and I was really excited. Only problem is : the lags behind by about 1 sec, which kinda beats the point of playing video games through line-in :S
Does anybody know how to tweak pulseaudio to get less (or no) lag ?
@Cedric, unfortunately, I’m not sure. From what I can tell, the PulseAudio control panels usually aren’t installed by default, so you might have to go looking for them.
Thank you!
This was one of the things that has kept my last Windows machine from being formatted. Now to find a way to play those Popcap games under Linux
Great article, my only question is how do you unload the module? It’s VERY loud and i had to jab a cord in the headset part so it would shut up. Unfortunately it didn’t work on my laptop, presumably because there is a microphone already setup on it.
I found a way to fix it. Basically make a script that starts on startup (no need to add the above loopback module). In the script but the line:
pacat -r –latency-msec=1 -d alsa_input.pci-0000_05_02.0.analog-stereo | pacat -p –latency-msec=1 -d alsa_output.pci-0000_05_02.0.analog-surround-51
where alsa_input.pci-0000_05_02.0.analog-stereo is your input device and alsa_output.pci-0000_05_02.0.analog-surround-51 is your output device as listed in the program paman. Best of luck.
Thank you! I wish I could have found this earlier.
While the loopback module may work for video games, is there any way to cut down on the delay?
I’m recording through some m-audio software, and I can’t monitor through my system which is a total bummer.
Please help. Many thanks!
@Tom
Hey Tom, Tyler posted a piece about this awhile ago http://thelinuxexperiment.com/guinea-pigs/tyler-b/fix-pulseaudio-loopback-delay/
However, I’ve heard that if you’re trying to record on Linux, your best bet is to move to an audio application that supports JACK. It’s supposed to be faster and provide lower-latency recording than something like PulseAudio.
To be honest though, I record a weekly podcast (http://www.slightlysauced.com) and I record it on Windows, because recording audio on Linux is a pain in the ass.
Best of luck,
Jon
@anon
Hello
It didn’t work for me and shut down my audio. Thanks to a Uberuser I know I was able to roll back the changes doing this:
The website said to do the following:
pactl load-module module-loopback
sudo sh -c ‘ echo “load-module module-loopback”>> /etc/pulse/default.pa ‘
The first line only affects your current session. It should have no effect after you restart your system. The second line appends the text “load-module module-loopback” to the end of the file /etc/pulse/default.pa. To remove that line from that file use this command in terminal:
sudo gedit /etc/pulse/default.pa
That just opens the file with gedit with root permissions. You could also just type “sudo gedit” by itself and then open the file from within gedit. That’s a good way of editing any files that require root permissions.
Scroll to the bottom of the file, delete the line that says “load-module module-loopback” (should be the last line) and then save and close the file. Restart your system and things should hopefully be back the way they were.
Good luck.
Rob
Lots Of Love
Works like a charm for my tv tuner
Thank you, also works on Debian Squeeze.
Why noone ever reads the documentation?
To remove the delay: load-module module-loopback latency_msec=1 (Warning: It may eat your CPU, increase the value if the CPU usage is too high)
@Nitsuga
What I always wanted to find out is how to activate HARDWARE monitoring that most sound cards support (coupling from mic input to sound output). It used to just work with ALSA, with no weird commands and CPU overhead.
How do you do that with pulse?
Just don’t dare tell me I’m not supposed to want that for whatever reason…
Solved similar issue with your post. Thank you!
Thanks, works like a charm to play records on my turntable.