How do I route the output of a single program to a mic input?
To redirect to mic input is not possible AFAIK, but fortunately it is not needed. What you have to do is just set up a new pulseaudio SINK which will automatically have a monitor SOURCE. No external programs needed, pulseaudio does the job. (Basically to accomplish such things is why pulseaudio was developed.)
So the question is whether you want to hear the sounds which you redirect to your new sink? (Play it on your speakers.) Or you don't.
If you DO want to hear what you are redirecting then follow the technique what I use for sending music over skype:
Get the name of your default sink:
pactl list sinks
In the output search for the name of the sink. It will be something similar to this: "alsa_output.pci-0000_00_14.2.analog-stereo"
Run the following command with the appropriate change in the master= section to your above found default sink name:
pactl load-module module-remap-sink sink_name=secondary master=alsa_output.pci-0000_00_14.2.analog-stereo
Open the application FROM which you want to redirect sound and start playing the sound in it.
Open the application TO which you want to redirect sound and start recording in it.
Start
pavucontrol
(If you don't have it:sudo apt-get install pavucontrol
)While your applications are playing/recording sounds: In pavucontrol, on the Playback tab change the sink from what it is on (Built-in ...) to the remapped sink (Remapped Built-in ....) for your application. On the Recording tab make similar changes for your recording application: change it to something like Monitor of Remapped...
Still in pavucontrol on the Input devices and Output devices tabs: change Show: to All Input devices and All Output devices and make sure that the remapped sink and its monitor source is not muted and have enough volume.
After this your setup should be working.
If you want to make your new sink to be automatically setup when pulseaudio starts: Edit the /etc/pulse/default.pa file and add the following line with your default master sink name in it (You will need root permissions to edit the file, so use sudo or gksu)
load-module module-remap-sink sink_name=secondary master=alsa_output.pci-0000_00_14.2.analog-stereo
Pavucontrol stores our changes (or at least for me it does), so next time you won't have to redirect the sinks-sources in it. (But if it won't save it for you, then do redirect them when you need.)
If you don't want to hear the sounds what you redirect then use simply
load-module module-null-sink
in the appropriate places (without sink_name or master section) and change the redirections in pavucontrol similarly as you did with the remapped sink but now with the null-sink and its monitor.
Related videos on Youtube
VmKid
Updated on September 18, 2022Comments
-
VmKid over 1 year
First, some context: I'm a part of a TF2 server that includes lots of micspam. I'm in the process of writing a guide on how to do this properly- namely using a media player and some form of audio pipe. On Windows, we achieved this by using Virtual Audio Cable or VB-Cable. I really haven't found any sort of equivalent on Ubuntu, at least none that worked for me.
For this, I want to know if there's some way to take audio from a single program, such as Banshee, and route the sound output into a mic input. Ideally, I'd like to be able to do this without changing sound servers.
Thanks in advance!
-
falconer over 10 years@VmKid So you tried
pactl load-module module-null-sink
? On my system it doesn't need sudo but try with it. If it still not succeeds then please do what is written here And try running the pactl command again, so we can see some more meaningful output from pulse. Of course don't post the log at Launchpad but put it on pastebin and give a link here. -
falconer over 10 years@VmKid Ohh. Or maybe my answer wasn't clear, and maybe you tried
pactl load-module module-null-sink sink_name=secondary master=alsa_output...
? When you load the null-sink then no other options are needed, justpactl load-module module-null-sink
Of course a sink_name can be added if you want, but master is not. The null-sink is just a dummy sink. -
VmKid over 10 yearsThat appears to have worked in a recorder. Hopefully it'll work within the Source Engine when I get a chance to test it for real. Thanks a lot!
-
StarCrashr over 4 yearsI'm following these instructions, but when I get to the part with pavucontrol, there's a problem. When I select to remapped audio channel, it doesn't change. It just continues to show the original default.
-
StarCrashr over 4 yearsUpdate: after closing and reopening the relevant applications a few times, it suddenly started working. Not sure why.
-
StarCrashr over 4 yearsWell, I'm trying to stream again today, and it's back to doing nothing. I get the impression that some other audio management program may be interfering. Any ideas?