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
ENV{PULSE_PROFILE_SET}="<profilename>"– telcoM Aug 15 '18 at 06:37pactl...works, but setting the same command into/etc/pulse/default.padoes not have any effect... I'm trying to setheadset_head_unit profileby default instead ofa2dp_sinkfor my headset unit. – Mauro Molinari Feb 15 '21 at 08:43/etc/pulse/daemon.conffile to see if/etc/pulse/default.pais used as default config and uncomment it if it's not and then reload pulseaudio withpulseaudio -k. – Eduard Sukharev May 26 '21 at 16:21pactl set-card-profileandpacmd set-default-sink– Pavel Tankov Oct 12 '22 at 15:15pulseaudio -k, but in Ubuntu 22.04 other things than Pulseaudio initialization keeps altering the card profile setting, and I had to do a couple of other things to set it right and make it stay right. The information about that is in this answer: https://askubuntu.com/a/1450325/339875 – njlarsson Jan 15 '23 at 20:31