[pulseaudio-discuss] Connect Alsa Input from hw:1, 0 to null-sink thru loopback

Sean Greenslade sean at seangreenslade.com
Wed Feb 16 08:23:04 UTC 2022


On Sun, Feb 13, 2022 at 09:49:30PM +0100, corbeille wrote:
> Hello,
> 
> I would like to know if there is a possibility to create at startup
> (maybe in /etc/pulse/default.pa ?) a "connection" between Alsa
> input hw:1,0 and a null-sink thru a loopback ?
> To have something similar to :
> 
> $ pacmd load-module module-null-sink sink_name=MySink
> $ pacmd load-module module-loopback source=hw:1,0 sink=MySink
> 
> Instead of :
> 
> $ pacmd load-module module-null-sink sink_name=MySink
> $ pacmd load-module module-loopback source=alsa_input.usb-0d8c_C-
> Media_USB_Headphone_Set-00.mono-fallback sink=MySink
> 
> Thus, I will be able to link "MySink" with any sound card on hw:1,0.
> 
> Is it possible ?

I don't think it's possible with the normal pulseaudio setup, since the
alsa cards are added after everything in default.pa is processed. The
module-udev-detect module dynamically loads and unloads alsa cards as
they are sensed by the hardware. It's a limitation of the
module-loopback code that the requested source/sink must exist at
loading time.

One thing you could do if your machine only has one sound card on a
non-removable connection (i.e. not a USB device) is to statically define
it with module-alsa-card and disable module-udev-detect.

A more resilient option might be to make a script that checks for the
presence of the loopback and loads it if it's not present. Then just
fire that script unconditionally before launching your programs that use
it.

--Sean



More information about the pulseaudio-discuss mailing list