How to handle audio from terminal

23 Jun 2022 - nicolas

List audio outputs:

pactl list | grep --after-context=3 '^Source'

List audio ports:

pacmd list-sinks | sed --quiet '/ports:/,/active port:/ p' | head --lines=-1 | tail --lines=+2

Show active audio port:

pacmd list-sinks | grep 'active port'

Play a sound:

pactl play-sample sampleNameHere