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

Sean Greenslade sean at seangreenslade.com
Tue Jun 2 02:26:06 UTC 2020


On Sun, May 31, 2020 at 09:56:10PM -0400, Samir Parikh wrote:
> I've played with this a bit more to update my steps.  I corrected some
> errors and I think I was able to piece together some more steps but still
> have a few open issues.  Here's what I've got so far based on my revisions:
> https://imgur.com/NzteBvg
> 
> Step 1:  Create the music_mic_mix virtual mixer
> $ pacmd load-module module-null-sink sink_name=music_mic_mix
> $ pacmd update-sink-proplist music_mic_mix device.description=music_mic_mix

Looks good. To help out discovery later on, you can also run this
command to give the monitor source a better name:

$ pacmd update-source-proplist music_mic_mix.monitor device.description=music_mic_mix.monitor

> Step 2:  Create the mic_loop loopback module and specify the sink as the
> virtual mixer created in step 1 (music_mic_mix)
> $ pacmd load-module module-loopback sink=music_mic_mix

If you want to be more automated, feel free to specify a source= here
pointing to your microphone's source if you know it's name. You can
figure out the correct name with the "pacmd list-sources" command.

> Step 3:  Create the music_only virtual mixer
> $pacmd load-module module-null-sink sink_name=music_only
> $ pacmd update-sink-proplist music_only device.description=music_only
> 
> Step 4:  Create the music_loop_headphones loopback module and specify my
> headphones output as the "real sink".  (I found the name using the pacmd
> list-sinks command.)
> $ pacmd load-module module-loopback
> sink=alsa_output.usb-Plantronics_Plantronics_BT600.analog-stereo

The source here can be specified. Since we're using the auto-monitor
source from the music_only virtual sink, the format is
virt_sink_name.monitor. For example:

$ pacmd load-module module-loopback sink=alsa_output.usb-Plantronics_Plantronics_BT600.analog-stereo source=music_only.monitor

> Step 5:  Create the music_loop_videoconf loopback module and specify the
> music_mic_mix created in step 1 as the sink
> $ pacmd load-module module-loopback sink=music_mic_mix

Same deal. Add "source=music_only.monitor" to the command.
 
> Step 6:  Connect the headset microphone to the mic_loop loopback module via
> the "Recording" tab in pavucontrol.

It's possible to skip this if you did what I mentioned in reply to step
2.

> Step 7:  Direct the output of Rhythmbox to the music_only virtual mixer
> created in step 3 via the "Playback" tab in pavucontrol.

Yep.

> Step 8:  Direct the output of the music_mix_mix virtual mixer created in
> step 1 to the video conference application in the "Recording" tab of
> pavucontrol.

Yep. If you ran the extra command I mentioned in step 1, this should
have the name music_mic_mix.monitor.

Also, if the recording app doesn't try to muck with things, pulse will
remember and re-apply your selection whenever the recording app is
launched.

> My question is how do I direct the output of the music_only virtual mixer
> created in step 3 to the music_loop_headphones and music_loop_videoconf
> loopback modules created in steps 4 and 5 (indicated by the red boxes in my
> revised diagram)?

Hopefully the above helped. While verifying that this works, I created
the following shell script. You'd have to swap the hardware sink/source
names, but it does work:

#!/bin/bash

# Step 1: music_mic_mix virt sink
pacmd load-module module-null-sink sink_name=music_mic_mix
pacmd update-sink-proplist music_mic_mix device.description=music_mic_mix
pacmd update-source-proplist music_mic_mix.monitor device.description=music_mic_mix.monitor

# Step 2: mic_loopback
pacmd load-module module-loopback sink=music_mic_mix source=alsa_input.pci-0000_00_1b.0.analog-stereo

# Step 3: music_only virt sink
pacmd load-module module-null-sink sink_name=music_only
pacmd update-sink-proplist music_only device.description=music_only
pacmd update-source-proplist music_only.monitor device.description=music_only.monitor

# Step 4: loopback for headphones
pacmd load-module module-loopback sink=alsa_output.pci-0000_00_1b.0.analog-stereo source=music_only.monitor

# Step 5: music loopback for videoconference recording input
pacmd load-module module-loopback sink=music_mic_mix source=music_only.monitor

# Step 6: already done in step 2.

# Step 7: Play music to music_only virt sink

# Step 8: Record from music_mic_mix.monitor



More information about the pulseaudio-discuss mailing list