Set default profile for PulseAudio

pulseaudio

How do I set the default profile that is used after each boot, in PulseAudio?

When I boot, sound doesn't work. If I open the PulseAudio Volume Control app, and go to the Configuration pane and select "Analog Surround 4.0 Output" from the Profile drop-down menu, then sound works again. However this only lasts until the next reboot.

How do I configure the system to use that profile in the future after reboots?

Best Answer

Add the following to /etc/pulse/default.pa:

set-card-profile <cardindex> <profilename>

How do we figure out what to use as cardindex and as profilename? Here's one way. Configure the card so everything is working. The cardindex will usually be 0, but you can find it by running pacmd list-cards and looking at the line index: .... To find the profilename, use

pacmd list-cards | grep 'active profile'

The name of the current profile should appear in the output. Remove the angle brackets (the < and >).

You can test your configuration by running

pactl set-card-profile <cardindex> <profilename>

from the command line to see if it sets the profile correctly, then add it to /etc/pulse/default.pa.

Since the index name is dynamic (it can change your PCI device index if you boot with a USB audio device plugged in), you could use <symbolic-name> instead of <index> (if you run pacmd list-cards, the symbolic name is right below the index). Also, the command might fail if the device is missing when starting pulseaudio so it might worth to wrap the command with an .ifexists clause:

.ifexists <symbolic-name>
pactl set-card-profile <symbolic-name> <profilename>
.endif
Related Question