[pulseaudio-discuss] need to run `pulseaudio -k` to record from null sink
Sean Greenslade
sean at seangreenslade.com
Mon Sep 6 23:12:30 UTC 2021
On Mon, Sep 06, 2021 at 08:45:57AM +0100, Gareth Walker wrote:
> Hello,
>
> I want to be able to capture both the microphone and the system sounds at
> the same time. To help me do that I have put the following commands in
> ~/.config/pulse/default.pa which create a null sink:
>
> .include /etc/pulse/default.pa
> load-module module-null-sink sink_name=MySink
> sink_properties=device.description=Mic_and_system_sounds
> load-module module-loopback
> source=alsa_input.usb-0c76_USB_PnP_Audio_Device-00.mono-fallback sink=MySink
> load-module module-loopback
> source=alsa_output.pci-0000_0a_00.3.analog-stereo.monitor sink=MySink
>
> When I first log in I can't record the monitor of Mic_and_system_sounds:
> but I can once I've run `pulseaudio -k`. Before I run that command, I can
> see Mic_and_system_sounds listed in the output devices in pavucontrol and
> nothing in the recording tab; once I've run `pulseaudio -k` I can also see
> the loopback to Mic_and_system_sounds from the microphone and from the
> soundcard in the recording tab of pavucontrol, and I can record the monitor
> of Mic_and_system_sounds.
>
> Is there a way around having to run `pulseaudio -k` each time I log in in
> order to be able to record the monitor of Mic_and_system_sounds? I hoped
> that by putting the commands in ~/.config/pulse/default.pa I would be able
> to do that right away on logging in. I am on Ubuntu 20.04.
Can you look at the logs to see if there are any errors listed when you
load the modules. The logs should be in your user journal, try this:
$ journalctl --user -u pulseaudio.service -e
My guess would be that the loopback module is trying to load before your
ALSA devices have enumerated. I ran into something similar when I was
working on advanced routing; my solution was to not load the loopback
modules from my default.pa file, but instead with an external script
that could verify the presence of the target sink before it ran.
--Sean
More information about the pulseaudio-discuss
mailing list