I'm trying to find out how to unload pulseaudio loopback outputs. I'm using pulseaudio to create a loopback mix to capture my microphone and system audio for streaming. Every time I launch my script which has this code:
pactl load-module module-null-sink sink_name=mix
pactl load-module module-loopback sink=mix
pactl load-module module-loopback sink=mix
avconv ...
pactl unload-module module-loopback
it leaves two output devices behind after it closes. The unload-module command gets rid of the recording one but I can't find a command for the outputs.
MODULE_NUMBER=$(pacmd list-sinks | grep -E "^\s*name:|^\s*module:" | grep -A 1 -E "^\s*name: <MY-SINK-NAME>" | grep -oP "module: \K[0-9]+")
whereMY-SINK-NAME
is what it says. Keep the<
>
in the code! – KrisWebDev Jan 24 '16 at 13:26pactl list short modules | grep "sink_name=MY-SINK-NAME" | cut -f1 | xargs -L1 pactl unload-module
. It has the advantage of deleting ALL modules namedMY-SINK-NAME
(sink names are not unique). – KrisWebDev Jan 24 '16 at 14:49