20

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.

3
  • Would you like a solution for this? What device are you trying to make the default?
    – Jonathan
    May 31, 2014 at 2:48
  • possible duplicate of How can I change the default audio device from command line?
    – BuZZ-dEE
    Jun 5, 2014 at 20:06
  • This question is not a duplication of that post. Maybe it would be more appropriate for the title to be "Change default default sound device" (the word default is intentionally used twice). Hope that clears things up a bit. Jun 9, 2014 at 13:16

7 Answers 7

36

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
7
  • 1
    Thanks! That was the only way to solve my problem, having every sound muted after ALSA & JACKD installation... May 27, 2015 at 7:32
  • Works like a charm on 16.04. Thanks a lot! Sep 25, 2016 at 13:17
  • Voting this up because it helped save a very similar issue in Debian. Thank you very much.
    – C26
    Apr 30, 2017 at 12:58
  • Still works on Ubuntu 17.10. I was first confused because pacmd list-cards only listed one card so I thought I could not switch. I want to switch from my laptop speakers to hdmi. This is the same card for me, just another output (analog-stereo vs. hdmi-stereo). Mar 22, 2018 at 10:32
  • Thanks a lot!!!!Struggled a lot to fix this...
    – ns15
    Oct 20, 2018 at 9:49
3

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

4
  • Thanks for the thourough response, unfortunately this didn't work. It would seem like this is the perfect solution but Ubuntu seems to ignore these preferences and continues to select the HDMI sound device on startup. Jan 15, 2014 at 10:41
  • Same for me. Did you fix it @OpenTangent?
    – umpirsky
    Mar 14, 2014 at 14:01
  • No, sorry. I just use Suspend now instead of Shut Down. I still need to correct it when i restart. Mar 15, 2014 at 16:48
  • I found a solution to this that works for me, in my answer below.
    – omikes
    Aug 29, 2018 at 20:30
1

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
)
1

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

1

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

enter image description here

0

You can set the default by ordering the sound cards in ALSA with slots=.

Find the driver module names for the sound cards you want to use by inspectinglsmod's output with: lsmod | grep -P '^snd[_]?[A-z]*' or just lsmod. For e.g. my Creative X-FI Xtreme Gamer is snd_ctxfi, my on-board is snd_hda_intel and my USB webcam is snd_usb_audio.

Now open up in a text editor or nano your corresponding ALSA config file e.g. sudo nano /etc/modprobe.d/alsa-base.conf and at the bottom add something of the following in order of precedence (the first declaration becomes default):

options snd slots=snd_ctxfi,snd_hda_audio,snd_usb_audio then to save just CTRL+o+enter & CTRL+x. Restart and you may be sorted.

0

Firstly, thank you to user224082 for your solution which helped me discover which device I needed.

To find which ALSA device you need:

  1. Using Multimedia Systems Selector, choose ALSA — Advanced Linux Sound Architecture for Plugin
  2. Test the different options under Device until the desired speaker is selected
  3. Make a note of the device= value in the Pipeline box. Mine was "hw:0,4"

Once you know which device you need, set it as the default:

Edit default.pa by typing sudo nano /etc/pulse/default.pa

At the very bottom of the file, add:

load-module module-alsa-sink sink_name=spkr device=hw:0,4
set-default-sink spkr

replacing the device= value with your device.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.