5

I have a USB device attached, which enumerates as a microphone. It streams some music, and I can easily record it with e.g. Audacity.

However, I want not to record it, but jsut listen on my headphones.

I have ALSA and Pulse Audio installed as usual. What is the best way to route the audio to my wishes?

2
  • Did you try a duplex profile: askubuntu.com/questions/73616/…?
    – Takkat
    Nov 25 '13 at 12:58
  • @Takkat The duplex profile works only if the input and the output are part of the same sound card.
    – CL.
    Nov 25 '13 at 13:00
5

I've picked this up some time ago. I hope it still works.

How to load a loopback device in PulseAudio

Open a terminal with Ctrl + Alt + T. Then enter

pactl load-module module-loopback

(without sudo or any special root rights). Now you should hear what is coming from your AUX-in. If not then open your audio settings dialog and try to change your settings from there. You will find the additional loopback-device.

If this works good and you want to have it on each boot, do this

sudo sh -c 'echo "load-module module-loopback" >> /etc/pulse/default.pa'

If for some reason you want to mute the device

pactl set-source-mute 1 1

To un-mute it

pactl set-source-mute 1 0

I've used this guide.

Related

2
  • I don't see an additional device in the Sound Settings after applying the command. The only output at the terminal was 35.
    – Vorac
    Nov 25 '13 at 12:54
  • 1
    @Vorac use pvaucontrol. Not seeing a new device is normal, as a loopback is neither a sink nor a source. Also note that when you have multiple sources or sinks, you need to specifiy those. It's all documented here
    – Aurelia
    Nov 25 '13 at 12:57
3

First, open a terminal. You want to use module-loopback to send input from a source right back to a sink. @MadMike's answer is alright if you just have one sink and one source, but you'll most likely have more.

First, find the source you want to use, type pactl list sources to get a list of your sources. Then, find the sink you want to loop back the same way, using pactl list sinks. Remember the names, on a default setup (using module-udev-detect) these will look like alsa_input.pci-0000_00_1b.0.analog-stereo

Next, you want to actually load module-loopback. This works the way @MadMike explained it, just be sure to include the sink and source names like this:

load-module module-loopback sink=alsa_output.pci-0000_00_1b.0.analog-stereo source=alsa_input.pci-0000_00_1b.0.analog-stereo

If you put this into your system-wide configuration (default.pa), put it at the end and wrap it into .fail and .nofail, so Pulse will still start even when the device is unplugged.

.nofail
load-module module-loopback sink=alsa_output.pci-0000_00_1b.0.analog-stereo source=alsa_input.pci-0000_00_1b.0.analog-stereo
.fail

When replugging the device, you'll also need to restart pulseaudio with pulseaudio -K (breaks active streams, restarts pulse immediately when autospawn is on)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.