All Articles

PulseAudio cheatsheet

PulseAudio seems to be the default sound system for many linux distributions, including mine. I often have to look up the commands when I want to e.g. change output ot a different device, such as my big “TV”-screen. Pulse seems to be a very powerful system in terms of configurability, I won’t cover much of it. My interactions with Pulse is only as a desktop user.

Here’s a cheatsheet for controlling it via pactl, the built-in commandline interface.

Terminology

  • sink is an output device (sound card, hdmi)
  • source an input device. I think. (microphone)
  • client is the application playing some sound
  • sink-input / stream a currently active audio stream.

List sinks

pactl list short sinks

For more verbose, skip short:

pactl list sinks

Set active/default audio device

pactl set-default-sink <sink-name>

Note: changing this does not change currently running sound. You may need to restart the application to have the sound come through the correct sink.

Mute (suspend) a sink

pactl suspend-sink <sink-name> 1 # mute
pactl suspend-sink <sink-name> 0 # unmute

Set Volume

pactl set-sink-volume <sink-name> 1.0

Redirect active stream to a different device

List active streams

pactl list sink-inputs

Copy ID of the stream into following command.

pactl move-sink-input <ID> <sink-name>

This should instantly move the stream without having to pause/resume. You can also use this to have different applications play on different devices. Pretty cool.

More stuff

I didn’t try it, but I’m pretty sure you can set up a pulse server listening on network traffic, meaning you can stream sound to a different device. Cool stuff. Maybe in the future I’ll try it.

Published Jun 29, 2019

Security Engineer with a dash of software. Originally from Stockholm, now in Berlin. I like to hack things.