Skip to main content

How to robustly switch pulseaudio output device from command line? [Resolved]

In Ubuntu and probably other distros there is a graphical thing to switch the audio output device. I have tried to write a command line tool that does the same thing, but it doesn't always work.

What I'm doing to switch to, say, sink 0 is the following:

pacmd set-default-sink 0

Which I think should make all new inputs go to sink 0. Then, for each existing input, according to pacmd list-sink-inputs I am doing:

pacmd move-sink-input  0

But it often doesn't work. Often I will switch sinks, then play some audio in some app and it will still be attached to the old sink. What am I missing here? How can I do this robustly?


Question Credit: George Kettleborough
Question Reference
Asked May 24, 2019
Posted Under: Unix Linux
6 views
1 Answers

Your Answer
D:\Adnan\Candoerz\CandoProject\vQA