Change default sound device

After upgrading to Ubuntu 13.10 my sound stopped working. I eventually figured out that Ubuntu had selected the HDMI sound device instead of my analogue speakers. I switched to the correct device and everything worked fine until I rebooted. I now have to select the correct device every time I boot Ubuntu. How do I set my speakers as the default device?

Edit: Since i upgraded to Ubuntu 14.04 Ubuntu now selects the onboard sound device by default so I no longer have this problem.


Solution 1:

Run:

$ pacmd list-cards

To display the index of your cards. For example, my pci sound card is at index 2. The sound profile for analogue output (again as an example) is called "output:analog-stereo".

Then:

$ pacmd set-card-profile 2 output:analog-stereo

To set this as the output (give it a try). To make it permanent, edit /etc/pulse/default.pa and add:

set-card-profile 2  output:analog-stereo
set-default-sink 2

Restart pulseaudio or reboot to check persistence.

If you want to also set mic(input) defaults

set-card-profile 2  output:analog-stereo+input:analog-stereo
set-default-sink 2

Solution 2:

On the Dash, search for Multimedia Systems Selector.

Open it and in its Audio tab you can select the default audio Input and Output devices.

enter image description here

This application is installed by default in Ubuntu Installation. But if you haven`t this somehow can install by

sudo apt-get install gnome-media

If it is not shown in the Dash, run:

gksudo gedit /usr/share/applications/gstreamer-properties.desktop

In the resulting text file, go to the line starts with NoDisplay=. Change the NoDisplay=true to NoDisplay=false

Solution 3:

The easiest solution for Ubuntu 16.04 was to create a script that listens when screen unlocks instead of script that listens to when system wakeups because it seems not all services are available at the instant that system wakes up. I couldn't get pulseaudio to switch to HDMI sound with a wakeup script but have successfully fixed it using the unlock listening script:

dbus-monitor --session "type='signal',interface='com.ubuntu.Upstart0_6'" | \
(
  while true; do
    read X
    if echo $X | grep "desktop-lock" &> /dev/null; then
        echo "screen locked"
    elif echo $X | grep "desktop-unlock" &> /dev/null; then
      /usr/bin/pacmd set-card-profile 0 output:hdmi-surround+input:analog-stereo
    fi
  done
)

Solution 4:

If you're using a newer 3.x gnome, show your launcher (default windows key) type settings -> sound. Select a different default, close the window.

Picture of the select sound window

Solution 5:

There's also an Audio Output Switcher GNOME extension, which provides quick access:

enter image description here