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.

OpenTangent
  • 319
  • 1
  • 3
  • 11

7 Answers7

37

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
bak202
  • 599
  • 1
    Thanks! That was the only way to solve my problem, having every sound muted after ALSA & JACKD installation... – Mathieu Rodic May 27 '15 at 07:32
  • Works like a charm on 16.04. Thanks a lot! – Stepan Vrany Sep 25 '16 at 13:17
  • Voting this up because it helped save a very similar issue in Debian. Thank you very much. – C26 Apr 30 '17 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). – Christopher K. Mar 22 '18 at 10:32
  • Thanks a lot!!!!Struggled a lot to fix this... – ns15 Oct 20 '18 at 09:49
  • Great solution. Thank you very much. This made it possible for me to switch sound-profiles and therefore devices (headphones, digital-spdif) via a keystroke in LXDE. This in combination with keystrokes for display switching makes multimedia on Linux so much more enjoyable than on Windows. – JackLeEmmerdeur Oct 26 '18 at 19:41
  • Helpful on my system too (MATE 18.04). – Marcus Oct 30 '19 at 07:45
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

  • 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. – OpenTangent Jan 15 '14 at 10:41
  • Same for me. Did you fix it @OpenTangent? – umpirsky Mar 14 '14 at 14:01
  • No, sorry. I just use Suspend now instead of Shut Down. I still need to correct it when i restart. – OpenTangent Mar 15 '14 at 16:48
  • I found a solution to this that works for me, in my answer below. – omikes Aug 29 '18 at 20:30
1

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

enter image description here

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
)
Pablo Bianchi
  • 15,657
nork
  • 11
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

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.

omikes
  • 361
  • 5
  • 10
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.

Jonathan
  • 656