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

corbeille corbeille at rybn.org
Sun Feb 20 08:43:29 UTC 2022


Hello,

Thank you for your answer.
At the end, I decided to create my null-sink in /etc/pulse/default.pa :

load-module module-null-sink sink_name=MySink
load-module module-alsa-source device=hw:1,0 source_name=MySoundcard1

Later in my program I make the loopback :

$ pacmd load-module module-loopback source=MySoundcard1 sink=MySink

Then, I can use gstreamer with : 

pulsesrc device=MySink.monitor ...

To read the audio stream.
++

Jack



Le mercredi 16 février 2022 à 00:23 -0800, Sean Greenslade a écrit :
> 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