Table of Contents

Ubuntu - Sound - PulseAudio - Set Port of Sound Card

Check for Port Names

pactl list sinks

returns:

Sink #1
	State: RUNNING
	Name: alsa_output.pci-0000_0b_00.4.analog-stereo
	Description: Starship/Matisse HD Audio Controller Analogue Stereo
...
...
...
	Ports:
		analog-output-lineout: Line Out (priority: 9000, available)
		analog-output-headphones: Headphones (priority: 9900, not available)
	Active Port: analog-output-lineout
	Formats:
		pcm
 
Sink #3
	State: SUSPENDED
	Name: alsa_output.pci-0000_09_00.1.hdmi-stereo-extra1
	Description: GP107GL High Definition Audio Controller Digital Stereo (HDMI 2)
...
...
...
	Ports:
		hdmi-output-1: HDMI / DisplayPort 2 (priority: 5800, available)
	Active Port: hdmi-output-1
	Formats:
		pcm

Set Sink Port

pactl set-sink-port 1 analog-output-lineout

or

pactl set-sink-port 1 analog-output-headphones

NOTE: If you are using a removable device, such as a USB device, it's better to use sink name instead of id.

pactl set-sink-port alsa_output.pci-0000_00_1b.0.analog-stereo analog-output-headphones

References

man pactl