I am a novice Ubuntu/Linux user and have just installed Ubuntu 16.04 LTS.
I noticed that Pulseaudio will always revert to an unwanted profile <output:analog-stereo>
after resuming from suspend (I want the default to be <output:hdmi-stereo>
). This seems to be an issue mentioned many times in this forum, but the suggested solutions don't seem to work for me.
I have tried editing the default.pa
file in /etc/pulse (and also tried putting a default.pa
in ~/.config/pulse/
as described in https://unix.stackexchange.com/questions/293399/how-to-set-hdmi-sound-output-as-default-on-ubuntu-16-04
However, by doing those edits, Pulseaudio will fail to load, leaving me with no sound.
I turned to a different approach. Since, by running the following in the terminal:
/usr/bin/pacmd set-card-profile 0 output:hdmi-stereo
does what I want (switches the profile), I thought I could maybe add a shell script that runs upon resume. This approach was also documented in many places, so I went ahead and tried it.
Under /lib/systemd/system-sleep
, which seems to be the appropriate place for 16.04, I put a script with the following code:
#!/bin/sh
case $1 in
post*)
/usr/bin/pacmd set-card-profile 0 output:hdmi-stereo
;;
esac
However, this does not seem to work either. I checked that the script was being run upon resume by replacing the pacmd
command with something like echo "hello" > /usr/text.test
, and confirmed that it's working.
What I have now is just a launch file on the desktop that runs the script containing the pacmd
command, which I double click every time I resume from suspend. It would really be nice if I could get this automated.