How do I route the output of a single program to a mic input?

7,347

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:

  1. 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"

  2. 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
    
  3. Open the application FROM which you want to redirect sound and start playing the sound in it.

  4. Open the application TO which you want to redirect sound and start recording in it.

  5. Start pavucontrol (If you don't have it: sudo apt-get install pavucontrol)

  6. 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...

  7. 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.

  8. 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.

Share:
7,347

Related videos on Youtube

VmKid
Author by

VmKid

Updated on September 18, 2022

Comments

  • VmKid
    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
    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
    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, just pactl 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
    VmKid over 10 years
    That 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
    StarCrashr over 4 years
    I'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
    StarCrashr over 4 years
    Update: after closing and reopening the relevant applications a few times, it suddenly started working. Not sure why.
  • StarCrashr
    StarCrashr over 4 years
    Well, 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?