1

I've made the change from Gnome to i3, and I want to be able to switch my audio output (from headphones to HDMI and vice versa) using the terminal.

$ pactl list cards | grep profile
            Part of profile(s): output:hdmi-stereo, output:hdmi-surround, output:hdmi-surround71
            Part of profile(s): output:hdmi-stereo-extra1, output:hdmi-surround-extra1
            Part of profile(s): input:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-surround-40+input:analog-stereo, output:iec958-stereo+input:analog-stereo
            Part of profile(s): input:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-surround-40+input:analog-stereo, output:iec958-stereo+input:analog-stereo
            Part of profile(s): output:analog-stereo, output:analog-stereo+input:analog-stereo, output:analog-surround-40, output:analog-surround-40+input:analog-stereo
            Part of profile(s): output:analog-stereo, output:analog-stereo+input:analog-stereo
            Part of profile(s): output:iec958-stereo, output:iec958-stereo+input:analog-stereo

Shouldn't my headphones be in the output above?

$ pactl list cards | grep headphones
        analog-output-headphones: Headphones (priority: 9000, latency offset: 0 usec, available)
                device.icon_name = "audio-headphones"

My attempt to change from headphones to HDMI:

$ pactl set-card-profile 0 output:hdmi-stereo
$ pulseaudio -k # Should this be necessary?

Nothing changes. Is there anything else I have to do? Changing output/sink is extremely easy using the Gnome settings, as it's just a matter of choosing either my headphones or my HDMI output.

Update with some more information:

$ pacmd list-sinks | grep -A 1 index
  * index: 0
    name: <alsa_output.pci-0000_01_00.1.hdmi-stereo>
--
    index: 1
    name: <alsa_output.pci-0000_00_1b.0.analog-stereo>

$ pacmd set-default-sink 0 # Does nothing as far as I can tell

Update:

$ pacmd set-default-sink alsa_output.pci-0000_01_00.1.hdmi-stereo && pulseaudio -k && pulseaudio -D

The above turns off all sound. This turns it on again (through the headphones):

$ pacmd set-default-sink alsa_output.pci-0000_00_1b.0.analog-stereo && pulseaudio -k && pulseaudio -D
7
  • Normally HDMI and analog show as different cards... does yours? If so, you'd probably use pacmd set-default-sink
    – derobert
    Nov 25, 2015 at 18:08
  • @derobert $ pacmd set-default-sink 0 didn't work, unfortunately.
    – Daffyd
    Nov 25, 2015 at 18:18
  • Did it give an error? Or just do nothing useful? (Also, that's not going to move a client that is currently connected; you need to use different commands to do that.)
    – derobert
    Nov 25, 2015 at 18:45
  • $ pacmd set-default-sink 0 && pulseaudio -k && pulseaudio -D turns of all sound though, until I set the sink to 1 again. I assume it changes the sink? There's no sound from my HDMI output though. Thanks for the help by the way.
    – Daffyd
    Nov 25, 2015 at 18:52
  • Is sink 0 the right one? Note BTW that you can also use the names (e.g., pacmd set-default-sink alsa_output.pci-0000_00_1b.0.analog-stereo).
    – derobert
    Nov 25, 2015 at 18:55

0

You must log in to answer this question.

Browse other questions tagged .