[pulseaudio-discuss] How to combine microphone audio and music from application to pipe to video conference

Sean Greenslade sean at seangreenslade.com
Sun May 17 04:29:09 UTC 2020


On Sat, May 16, 2020 at 11:34:56PM -0400, Samir wrote:
> Sean Greenslade wrote on 5/16/20 1:23 AM:
> 
> > Pulse has two types of sound devices, sources and sinks. Sources are
> > input devices like microphones. Sinks are output devices like speaker or
> > headphone ports. Programs that work with sound can attach to sources in
> > order to pull sound in, and can attach to sinks to output sound. I
> > suggest playing around with the "pavucontrol" utility to see what
> > sources and sinks are present on your machine. It also shows what
> > applications are recording or playing back audio, and allows you to
> > redirect existing audio streams on the fly. It's quite handy.
> > 
> Sean,
> 
> Thanks so much for your quick and detailed reply to my post (and apologies
> for taking so long to respond!).

No worries, email lists are meant to be asynchronous.

> I'm still trying to wrap my head around your steps but am encouraged that
> this may be possible with just Pulse Audio and no external hardware.
> 
> When I run "pavucontrol" with Rhythmbox playing music, here is what the
> "Input Devices" tab looks like with "All Input Devices" shown:
> https://imgur.com/a/kSth4O1
> 
> The "Monitor of Built-in Audio Analog Stereo" input corresponds to the music
> coming from Rhythmbox.  The "Built-in Audio Analog Stereo" is my laptop's
> built-in microphone.

Every sink device (audio outputting hardware), both real and virtual,
will automatically have a "monitor source" created for it. This monitor
source allows a recording app to record the sounds that a sound output
is producing.

> Given that, do I still run your two commands to create the "virtual mixer"?

If your goal was to only play your system audio into the
videoconference, you would indeed be able to use just the automatic
monitor source. However, you would need to make sure the videoconference
app is not outputting its sound to that sound card, otherwise you would
be looping the conference audio back into the conference and causing
echos and possibly feedback.

With my suggested virtual sink approach, you can feed your music app
into the virutal sink and record only that. Meanwhile the
videoconference audio output goes to your real soundcard output.

The third command in my original response takes care of the task of
feeding microphone audio into the virtual mixer. This is not set up
automatically because it would be easy to accidentally feed your mic
into your speakers and cause loud feedback. By specifying the virtual
mixer sink in the command, this prevents that incorrect routing.

> $ pacmd load-module module-null-sink sink_name=virt_mix
> $ pacmd update-sink-proplist virt_mix device.description=VirtualMixer
> $ pacmd load-module module-loopback sink=virt_mix
> 
> While I'm comfortable on the command line, I don't know anything about Pulse
> Audio so just wanted to double-check and take this step-by-step.

The nice thing about doing this via the command line is that the changes
are not permanent. If you find that things wind up in an unexpected
state, you can simply kill pulseaudio and let it respawn with its
default settings:

$ pulseaudio -k

There's lots of information about the modules I've used here on the
pulseaudio online docs:

https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Modules/#module-loopback

Feel free to experiment and ask about anything else that's unclear. I
know it took me a while to wrap my head around the concepts of sources
vs source outputs vs sinks vs sink inputs.

--Sean



More information about the pulseaudio-discuss mailing list