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?

Vorac
  • 319
  • 4
  • 17
  • Did you try a duplex profile: http://askubuntu.com/questions/73616/how-to-set-the-sound-setting-so-that-you-can-listen-to-this-device-i-e-an-ext? – 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

2 Answers2

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

MadMike
  • 4,244
  • 8
  • 28
  • 50
  • 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)

Aurelia
  • 37