Skip to content

Instantly share code, notes, and snippets.

@przbadu
Created October 21, 2020 05:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save przbadu/788b97c276d1b1e7a7533fdda1fe22d9 to your computer and use it in GitHub Desktop.
Save przbadu/788b97c276d1b1e7a7533fdda1fe22d9 to your computer and use it in GitHub Desktop.
Change audio output source in linux

Get the audio sources

To get complete response

pacmd list-sinks

To get short response

pactl list short sinks

To set default output sink

pacmd set-default-sink "SINKNAME"

To set default Input

pacmd set-default-source "SOURCENAME"

To control volumn

pacmd set-sink-volume index volume

Volume control

Volume control values are

  • 65536 - 100%
  • 0 - mute

OR, bit more intuitive way to set proper volumn can be

  • 0x10000 - 100%
  • 0x7500 - 75%
  • 0x0 = 0%
pacmd set-source-volume index volume

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment