Terminology
- Source: A source is an input device. It is an active unit that produces samples. (microphone)
- Source output: A source output is a recording stream. It is a passive unit that is connected to a source and consumes samples from it. (recording stream opened by an application)
- Sink: A sink is an output device. It is an active unit that consumes samples. (output sound device, e.g. headphones)
- Sink input: A sink input is a playback stream. It is a passive unit that is connected to a sink and produces samples for it. (playback stream opened by an application)
- Card: A card represents a physical audio device, like a sound card or Bluetooth device
- Device port: A device port represents a single input or output port on the card
- Device: A device represents an active sample producer (input device) or consumer (output device).
- Stream: A stream represents a passive sample consumer (recording stream) or producer (playback stream).
Commands
man pulse-cli-syntax
Listing
List sinks
pacmd list-sinks
pactl list sinks
pactl list short sinks
Get sink ID
pactl list short sinks | grep -i hdmi
Set default sink
pactl set-default-sink "$( pactl list short sinks | grep -i hdmi | cut -f 2 )"
Sources of sound
pactl list sink-inputs | cut -f 1
Move all sources of sound to the new output of sound
pactl move-sink-input #sink-input-id #sink-id
Script to move all sink inputs to a new sink
Is the same script written differently.
sink_id="$( pactl list short sinks | grep -i hdmi | cut -f 1 )"
while IFS='' read -r line ; do
input_id="$( echo "$line" | cut -f 1 "$line" )"
echo "$input_id"
pactl move-sink-input "$input_id" "$sink_id"
done < "$( pactl list short sink-inputs )"
sink_id="$( pactl list short sinks | grep -i hdmi | cut -f 1 )"
pactl list short sink-inputs | cut -f 1 | while IFS='' read -r line ; do
input_id="$line"
pactl move-sink-input "$input_id" "$sink_id"
done