You can control PulseAudio thoroughly through the command line using pacmd
and pactl
commands. For options see pacmd --help
or the wiki at PulseAudio:
pacmd list-sinks
for name or index number of possible sinks
pacmd list-sources
for name or index number of possible sources
pacmd set-default-sink "SINKNAME" | index
to set the default output sink
pacmd set-default-source "SOURCENAME" | index
to set the default input
pacmd set-sink-volume index volume
pacmd set-source-volume index volume
for volume control (65536
= 100 %, 0
= mute; or a bit more intuitive 0x10000
= 100 %, 0x7500
= 75 %, 0x0
= 0 %)
and many many more CLI options.
Note: Changing the output sink through the command line interface can only take effect if stream target device reading is disabled. This can be done by editing the corresponding line in /etc/pulse/default.pa
to:
load-module module-stream-restore restore_device=false
Restart PulseAudio for changes to take effect:
pulseaudio -k
For a more elaborate tutorial on how to do this, and for instructions on how to change the sink during playback see this answer.
pacmd list-sinks
I think – Anwar Jun 14 '12 at 18:59/proc/asound/cards/
it lists the Toneport as a USB device and under/proc/asound/pcm
it saysplayback 1: capture 1
. This is all after runningalsamixer
and clicking [f2]. – May 01 '13 at 19:15pacmd list-sinks
lists only one sink but you can see several output devices in System Settings > Sound, check this answer: http://askubuntu.com/questions/63599/configuring-hdmi-audio-via-command-line – Severo Raz Jul 20 '14 at 21:59pactl list short sinks
for a simpler list of sinks. You need the symbolic name. – Tim Richardson Jan 06 '18 at 20:37/etc/pulse/default.pa
to readload-module module-stream-restore restore_device=false
. If you do not, then PulseAudio will ignore the default sink for any program you have used before (even if it is no longer running). PulseAudio is trying to be clever and now treats the default sink as only a "fallback", to only be used if it doesn't know better. And, PulseAudio always seems to knows better. – hackerb9 May 05 '20 at 23:27pacmd set-default-sink $(pactl list short sinks | grep hdmi | awk '{print $2}') && pulseaudio -k
– Anand Rockzz Jun 13 '21 at 15:04