38

I work on two computers with one USB headset. I want to listen to both by piping the non-Linux computers' output into the Linux computer's line in (blue audio jack) and mixing the signal into the Linux computer's headset output using PulseAudio.

Audio hardware diagram

pavucontrol shows a "Built-in Audio Analog Stereo" Input Device which allows me to pick ports like "Line In" (selected), "Front Microphone", "Rear Microphone". I can see the device's volume meter reacting to audio playback on the non-Linux machine.

Built-in Audio Analog Stereo

How do I make PulseAudio play that audio signal into my choice of Output Device?

qubodup
  • 2,316
  • 3
  • 19
  • 26

2 Answers2

51

1. Load the loopback module

pacmd load-module module-loopback latency_msec=5

creates a playback and a recording device.

2. Configure the devices in pavucontrol

In pavucontrol, in the Recording tab, set the "Loopback" device's from input device to the device which receives the line in signal.

recording settings

In the Playback tab, set the "Loopback" device's on output device to the device through which you want to hear the line in signal.

playback settings

3. Troubleshooting

If the audio signal has issues, remove the module with pacmd unload-module module-loopback and retry a higher latency_msec= value

Additional Notes

Your modern Mid-Range computer might easily be able to manage lower latency with the latency_msec=1 option:

pacmd load-module module-loopback latency_msec=1

This answer was made possible by this forum post. Thanks!

Ulterno
  • 5
  • 3
qubodup
  • 2,316
  • 3
  • 19
  • 26
  • 1
    I do not see that _loopback_ text in pavucontrol, but it works anyway. I can unmute the input device and adjust the input level in _Input Devices_ tab. Maybe it is due to newer version of software, Ubuntu 20.04 here. See also [the module documentation](https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#module-loopback). – jarno Nov 11 '20 at 19:25
  • I had to add `source` setting in the `load-module` command to make it work more reliably. – jarno Nov 11 '20 at 20:53
  • @jarno Thanks for that info. I do not see any "loopback" text inside the Playback tab of pavcontrol, but I *do* see it inside the Recording tab. Also, when I first ran the `pacmd load-module module-loopback latency_msec=5`, it emitted a loud noise through the speakers that were currently playing. I had to quickly execute `pacmd unload-module module-loopback` to turn it off... – bgoodr Nov 29 '20 at 06:14
  • ... then reduce the speaker volume (via a physical volume control dial on the side of the speakers), then try loading the module again. Again the noise continued, but then I discovered only when I switched to the Recording tab, and switched "Loopback to Builtin Audio Analog Stereo from" from "Monitor of Built-in Audio Analog Stereo" to just "Built-in Audio Analog Stereo", it started to play normally without the noise. This is running under Xubuntu 20.04.1 LTS. – bgoodr Nov 29 '20 at 06:16
  • @bgoodr Recording tab is empty if "No application is currently recording audio", unless I change the Show setting in the bottom of the tab. I also have "Monitor of Built-in Audio Analog Stereo" available for the respective stream, but switching to that does not succeed, so it is just using "Built-in Audio Analog Stereo". – jarno Nov 29 '20 at 09:40
  • 1
    BTW It is good to unload the module, when you do not use it, because it uses CPU for nothing otherwise. – jarno Nov 29 '20 at 09:43
  • @jarno I've noted `top` showing the module consuming 5% of cpu while it is running. So your observation is "spot on". Thank you. – bgoodr Dec 12 '20 at 20:08
0

As stated in the preferred answer

pacmd load-module module-loopback latency_msec=5

Which should create a playback and recording device, doesn't seem to work in all cases. In that case, you can attempt

pactl load-module module-loopback latency_msec=5

Notice the similar arguments, using pactl

For me it didn't work with pacmd, did with pactl.

Note: Both these options are only for Pulse Audio and not for Pipewire

Ulterno
  • 5
  • 3
Edward
  • 1
  • Please [edit] this so it makes sense even if the other answer is deleted.   ***Reference*** the other answer (by stating the name of the author), but copy all essential information into your answer. – G-Man Says 'Reinstate Monica' Dec 01 '18 at 18:50