Microphone to Speaker passthrough on Linux/WSL

Sometimes you want to use a device and watch a video at the same time and you need to use headphones. In such cases it would be useful to pass the sound through your computer to your headphones without some sort of external mixing because reasons. On Linux this is actually very easy. You can use the pulsaudio(pavucontrol)'s loopback function to pipe a microphone or any other audio source through the microphone jack to the headphone jack. There is actually only one command needed. I use a bash file and created a menu entry so I can open it like a normal program. You can the audio-mixing of your desktop to controll the volume of the passthrough. Just use the microphone volume setting on your system. And YES this only works on Linux and WSL

BE CAREFUL! IF YOUR MICROPHONE SETTINGS ARE TOO HIGH YOUR PASSTHROUGH WILL BE EXTREMELY LOUD! LOWER YOUR MICROPHONE VOLUME BEFORE YOU TRY THIS! IT ALSO CAN DAMAGE YOUR MICROPHONE INPUT BECAUSE IT IS ABSOLUTELY NOT MADE FOR SUCH HIGH VOLTAGES. KEEP THE VOLUME OF YOUR DEVICE RELATIVELY LOW. FIND THE SWEET SPOT WHERE THE AUDIO IS LOUD ENOUGH SO YOU DON'T NEED TO MAKE THE SYSTEM MICROPHONE SO LOUD THAT YOU CAN HEAR STATIC NOISE. AND AGAIN, BE CAREFUL WITH THE MICROPHONE SETTINGS ON YOUR COMPUTER. IF THE MICROPHONE IS SET TO LOUD YOUR HEADSET WILL BE SO LOUD IT CAN BREAK OR EVEN HURT YOUR EARS. AS ALWAYS: IF YOU ARE DOING ANYTHING ON THIS WEBSITE, ITS OBVIOUSLY AT YOUR OWN RISK!


Plug an AUX cable into your device's headphone jack and the other end into your computer's microphone jack. And yes, you can even use Bluetooth with this. IDK how good this will work or what input and output you need to set but it works.

You need to install pavucontrol.

Now you can pipe the sound through. Normally it automatically recognizes what you are trying to do. If that is right then this command is enough:

pactl load-module module-loopback

If it doesn't work right automatically, then you need to use this command and change source and sink until you find the right source and output (Be careful! Sometimes you pipe some random noise through and that can be very VERY LOUD!):

pactl load-module module-loopback source=1 sink=0

You will notice that the command dose not wait for your input and the service runs in the background. To stop the passthrough you need to stop the service:

pactl unload-module module-loopback

To make it easy to use you can create a bash file:

#!/bin/bash clear echo "Mic2Speaker" echo "By CatWithCode" echo "" read -p "CHECK THE MIC VOLUME!!! THEN PRESS THE ANY-KEY!" echo "" echo "ID:" pactl load-module module-loopback #latency_msec=1 echo "" read -p "Press the Any-Key to Stop & Exit" pactl unload-module module-loopback exit

"latency_msec=1" can be used if your pass-through does not sound clean for some reason.

That's it. If you create a menu entry you can start/exit it way more easily. With programs like menulibre (or you do it manually) it's done in seconds. Here is the command I use to start the bash file:

gnome-terminal -- /PathToTheBashFile/Mic2Speaker.sh


Sources: