How to: Tips and Tricks

Ubuntu: Make ALSA default instead of PulseAudio

PulseAudio has still problems with some applications and it always adds a little latency and that's the reason, why so many people still prefer ALSA. This howto shows you, how to remove PulseAudio, add alsa-mixer applet to the panel and associate hotkeys for volume change.

1. Remove PulseAudio

This will uninstall PulseAudio, delete the configuration files and uninstall it's dependencies; gstreamer-10-pulseaudio, libpulse-browse0, libpeexdsp1, pulseaudio-esound-compat, pulseaudio-module-udev, pulseaudio-module-x11, pulseaudio-utils, rtkit and gnome-desktop (don't worry, it is dummy package):

sudo apt-get purge pulseaudio

2. Install alsa-mixer (volume) applet

PulseAudio removes volume applet, so you need new volume applet. For getting it to work, you need to intall the following packages: python, python-notify, python-gtk2, python-alsaaudio and xfce4-mixer or gnome-alsamixer (i preffer xfce4-mixer).

sudo apt-get install python python-notify python-gtk2 python-alsaaudio python-eggtrayicon xfce4-mixer

Download alsamixer-applet:

wget http://howto.blbosti.com/files/alsa/alsa_mixer_applet_1.1.tar.gz

Extract all files for example into /usr/local/bin direcotry:

sudo tar -C /usr/local/bin/ -xzvf alsa_mixer_applet_1.1.tar.gz

Make all files executable (if they're not):

cd /usr/local/bin
sudo chmod +x alsa*
sudo chmod +x volbar.py

If you want to use your keyboard's volume hotkeys, you have to set them in System > Preferences > Keyboard Shortcuts. Click Add.

Name:      ALSA Volume mute
Command:   /usr/local/bin/alsa_master_mute
Name:      ALSA Volume down
Command:   /usr/local/bin/alsa_master_down
Name:      ALSA Volume up
Command:   /usr/local/bin/alsa_master_up

Then click on Disabled in the second column and map your hotkeys for these actions.

Finally the programs volbar.py and alsavol.py have to be set to start automatically. This can be set under System > Preferences > Startup Applications. Click Add:

Name: volbar
Command: /usr/local/bin/volbar.py

Name: alsavol
Command: /usr/local/bin/alsavol.py

Note: If you have installed gnome-alsamixer instead of xfce4-mixer, you need to edit volbar.py

sudo gedit /usr/local/bin/volbar.py

Find the line 97 and replace xfce4-mixer to gnome-alsamixer:

subprocess.Popen("gnome-alsamixer")

Now restart your computer and test, if everything is working.

A click on the tray icon opens the slider.

volume slider

Double-clicking opens the mixer.

xfce4-mixer

Use hotkeys to change volume – these changes will be shown via libnotify.

volume libnotify

Note: Unfortunately, this solution is not perfect, because Totem does not play audio and in Nautilus does not work audio preview on mouse over. If you have any other solution, please, let me know.

UPDATE

ThomasEgi wrote another solution:

Instead of removing pulseaudio you can also stop if from auto-restarting and simply killing it of with an auto-starter each time you login.

echo autospawn = no|tee -a ~/.pulse/client.conf && killall pulseaudio

After that, simply put killall plulseaudio into your autostart. You still need the alsa-mixer stuff and totem/audio-preview are also broken. but it’s quite useful for when you want to temporarily switch to alsa or any other sound system.

Files to download:

Edit: I found another way at webupd8.org.

Credit goes here and here.

  • Really, noticeable delays with PulseAudio? I haven’t seen that, and I made a lot of screencasts last year, using a mediocre laptop. The PulseAudio control panel has really saved my bacon when I kept switching microphones. I don’t think getting rid of it is the answer. But to each their own–it’s the Linux way :-)

  • People really need to stop complaining about Pulseaudio. Pulseaudio is not broken. It is way better than anything that Linux has ever had in this area, and it does not create latency, it in fact improves it in a multi-audio environment. If programs don’t work well with Pulseaudio it is because of the extremely broken infrastructure we had before. Plusaudio is a fix for what we used to have. If you want good audio in Linux, you need to support Pulseaudio. I haven’t run in to any programs that don’t support and work great with Pulseaudio for the past year and half, if not longer.

  • instead of removing pulseaudio you can also stop if from auto-restarting and simply killing it of with an auto-starter each time you login.

    echo autospawn = no|tee -a ~/.pulse/client.conf && killall pulseaudio

    after that, simply put killall plulseaudio into your autostart.

    you still need the alsa-mixer stuff and totem/audio-preview are also broken. but it’s quite useful for when you want to temporarily switch to alsa or any other sound system.

  • Using OSS4 instead of PulseAudio works very well too. Unfortunately, it looks like a lot needs to happen for it to make it into the kernel.

    As for PulseAudio, it was clearly brought into distributions long before it was ready. Until it is, there should be a straightforward way of switching the audio system.

  • I recommend using OSSv4 instead of either ALSA or Pulse. That’s what I do and I never have any issues whatsoever with audio anymore, unlike when I used Pulse Pulse which crashed constantly.

  • I have often met with the question of how to remove pulseaudio and make alsa default. So I wrote this howto.
    Bad latency? Try LMMS with PulseAudio (I don’t like this combination).

  • Help me understand why I want to remove Pulseaudio? Pulseaudio does not replace ALSA. It removes the additional layer between ALSA, ESD, and the kernel, so why would I replace Pulseaudio with ALSA as it does nothing for me, but add complexity back into the mix.

    Why not FIX the problem you are having? (going back to the complex legacy audio is NOT fixing the problem). The easiest way to FIX your issues is to file a bug on it.

    95% of the users out there are running Pulseadio since 9.10 with NO problems including ME. It runs great on 10.04 LTS beta 1.

  • ALSA doesn’t support multi access to sound.

    Why should Linux users, especially new ones, be crippled by those who can’t get PulseAudio working.

    The problem isn’t PulseAudio, it’s people’s configuration, most likely old modified scripts from various updated OS series, or a not so good sound chip driver that needs more attention.

  • Umm ALSA does support multi access to sound, dmix for output and dsnoop for input. It is part of the reason that everyone moved from OSSv2 to ALSA all those years ago.

  • The real issue is to investigate any potential problems with your sound card so that it works OK with PulseAudio.

    Going back to Alsa is silly and does a disservice to open-source software. Make an effort to figure out the source of any audio problem.

  • I’m using Debian Squeeze – I was initially dissatified with PulseAudio. However, a few updates later, it works fine. The only problem I’ve got is quake2(yes I know its ancient)- there’s either no sound or very corrupted sound that sounds like small samples fed through an echo.I suspect this is as much quake2’s fault as PulseAudio’s. If anyone’s got a suggestion that actally works, that’d be great, though I’ll give ThomasEgi’s idea a go,& see if that helps.

  • Yes, I admit, pulse works well for most audio chips. It does not seem to cooperate with mine made by the infamous ATI. Since, ati is known to be hostile to foss, the blame should fall on it. However, i have had no problems with the old pre-pulse alsa-only setup. Now I do. Most reliable applications like mplayer, xmms, amarok crash on a regular basis under pulse. They never did so before.
    The issue is not that PulseAudio is bad. It is rather the fact, that NO ALTERNATIVES are offered. You pretty much have to use PA, or you inflict a lot of headache after its removal. I managed to diminish that to almost nothing: the only problem I am having is the capriciousness of ekiga crashing every now and then without pulse (perhaps it wants oss, which i do not have). This is a minor headache compared to that when using Pulse.
    Misconfiguration might be the culprit, nevertheless, this is a BUG and I do not want to wait until it gets fixed. My video chip dri related bug hasn’t been fixed for years.

  • PulseAudio still has a lot of severe problems with many applications that are likely to be unsolved. The ALSA situation hasn’t been great, but we are where we are and the situation has not improved. If you’ve ever tried to play a game on a Linux distribution that you’ve played over many years (Castle Wolfenstein) the latency is an absolute joke. We’re talking a couple of seconds at times, and it can be random. That is NOT the fault of the application because it was developed for what was available and recommended.

    File a bug about this? It’s your distribution. It’s your configuration. You’re using an application that doesn’t interest most people and doesn’t interest the PulseAudio developers. Use pure ALSA? The problems go away. Use OSS with ALSA emulation? The problems go away.

    What do you expect to happen? I’m not debugging PulseAudio because it is somehow my fault – apparently.

    Sorry, but PulseAudio has set sound back on Linux many, many years. We had just managed to get over the disaster of ALSA. The move should have been minimise or even eliminate the need for userspace sound servers, but we now have something else to go wrong. dmix is an option, it has its own problems but it’s an example of a simple approach that should have been taken to the ‘problem’.

  • In addition, you’ve still got many multimedia applications like MythTV actively telling users to turn it off – no questions asked. That tells you it isn’t good enough.

    Multimedia sound on a desktop? Maybe we should get to a well thought through solution that works first of all before telling users to just lump it?

  • One thing is for sure. Linux audio in general, is nothing but a piece of broken-KAKA, it’s full of egocentric dev/programmer fools. why ?, why is this ?
    Because unless “they” think if it, or invent it, well it just can’t be any good, right ?!
    This is the same mindset that Mr. Linus Gates-Torvalds took over ZFS ! Torvals is just a big-baby.
    alsa, pulseaudio, oss, esd, …, grandma’s panties, …
    So after PA fails, they should name their next audio fiasco “Pride-Pulse” -as in “PeePee”, “pride before the FALL!”
    There is a complicated (but getting blurrier each day) level between “real” professional linux audio enthusiasts, (like the uses of JACKd,…) and the likes of most users.
    Basically the average consumer just needs to “click on APP and sound is supposed to be Heard, and properly, ALL THE TIME” -Windows has been doing this flawlessly even BEFORE Linux was born. And Apple, has been doing this even longer.
    Linux (mostly the fools I mentioned above) are destroying the “viablity” of Linux to ever become a good alternative Windows-replacement OS.
    For krist’s sake ppl. Its “audio” ‘ya know 2020kHz, can we not even get this right in Linux after 18 freekin’ YEARS !
    Linux, didn’t seem get it right with esd, alsa,…, and simply adding yet another complication-“bandaid” like pulseaudio isn’t going to fix it all.
    ALSA probably came close, but OSS semmed to have the BETTER “universal” quality overall, to me, and I’m talking about average comsumer-level needs and wants.
    I have no idea where OSS is going now though. ?
    Until Linux dev’s realize that there has to be “STANDARDS” at the interface-level of audio hardware to the firmware/driver/software just in front of it then it’ll never really work for “everything”.
    every audio application will “HAVE” to talk a certain amount of agreed-upon language for all to work.
    Running different directions at the same time is gonna get the rest of us NOWHERE, as this past “linux audio” has laughingly proved.
    Oh ya, and when things get real pushy, lets blame those “windows-only-proprietary” audio chipmakers’ because it all their fault for needing-to-make-a-living.
    Naaa, I say this time, Linux has no one to blame but themselves.
    “OPEN”-Hardware anyone ?
    Happy Now ?!

  • Thank you very much for your solution. I’ve have problems with Pulseaudio both in Ubuntu and OpenSuse so far

  • For those who have problems with old games (that use ALSA incorrectly) in combination with PulseAudio: why don’t you just run those games with ‘pasuspender’?

  • Be aware: Purge of pulseaudio CAN TRASH YOUR SYSTEM.

    I did a purge on pulseaudio; then I spent the next two days trying to fix my broken system to where I could even log into the gnome desktop environment. Inspection of the apt log revealed that the purge removed 97 core system components, libraries, and applications along with pulseaudio.

    This is not a joke. If you want to see the list of what was removed by “sudo apt-get purge pulseaudio” see my post at http://ubuntuforums.org/showthread.php?t=1496120 .

    I’m running ubuntu lucid (10.04) on a Dell Inspiron 9100.

  • This tutorial is for 9.10, but it works also under 10.04.. the command “sudo apt-get purge pulseaudio” removes only gnome-desktop dummy package, not the whole gnome-desktop.
    http://howto.blbosti.com/wp-content/uploads/2010/06/purge-pulseaudio2.png

  • PulseAudio still has a lot of severe problems with many applications that are likely to be unsolved. The ALSA situation hasn’t been great, but we are where we are and the situation has not improved. If you’ve ever tried to play a game on a Linux distribution that you’ve played over many years (Castle Wolfenstein) the latency is an absolute joke. We’re talking a couple of seconds at times, and it can be random. That is NOT the fault of the application because it was developed for what was available and recommended.

    File a bug about this? It’s your distribution. It’s your configuration. You’re using an application that doesn’t interest most people and doesn’t interest the PulseAudio developers. Use pure ALSA? The problems go away. Use OSS with ALSA emulation? The problems go away.

    What do you expect to happen? I’m not debugging PulseAudio because it is somehow my fault – apparently.

    Sorry, but PulseAudio has set sound back on Linux many, many years. We had just managed to get over the disaster of ALSA. The move should have been minimise or even eliminate the need for userspace sound servers, but we now have something else to go wrong. dmix is an option, it has its own problems but it’s an example of a simple approach that should have been taken to the ‘problem’.

  • RE: PulseAudio apologists: if it does not work for me, doing what I need it to do, it is broken. For me. Filing a bug report is fine. Followed by removing PulseAudio and using something that is *not* broken. Being broken is not an acceptable state. “Stop whining” is not an acceptable answer to brokenness. “It works better for me” has no logical relationship to “it works better for others”. The author here has provided an acceptable answer (which I’m thankful for); why denigrate him for providing it, or others for using it?

    When PulseAudio stops being failgasm – when I can use it without it stuttering, hogging CPU, crashing Flash, killing framerates in games – when that happens and if there is no superior solution, then I will use PulseAudio. Until then ALSA works. PulseAudio does not need my “support” in the form of rendering my system needlessly frustrating/unusable/requiring constant troubleshooting. That is stupid and counterproductive. Oi, fanboi.

  • Thanks for this post! I removed Pulse Audio because I wanted sound from different programs to play simultaneously. I uninstalled it but the sound applet is no longer available; when “Sound” is open from System > Preferences, I get the error “Waiting for sound system to respond.”

    After searching I finally arrived at your site, and the solution is perfect (until Pulse Audio works better) in that I can now control sound from the applet and the keyboard. Thanks so much!

  • The taskbar icon doesn’t change when you use the hotkeys. But knotifier displays the change.
    The icon changes when scrolling the mouse over the icon.
    Maybe one can insert a 10 seconds loop to update the icon to correct state?

  • Thanks a lot for the help with this, everything seems to be working fine but for one small point: Double clicking the volume applet doesn’t open the mixer for me. Does anyone have any ideas why this is so? Also, as Marcel mentioned in October, the volume icon in the panel doesn’t recognise when the hotkeys are used, although the changes appear in the notifier bubble.

    Any help is greatly appreciated.

  • If any of you gentleman can get Digital Passthrough working without removing Pulse Audio on Ubuntu 10.10 I am all ears????

  • FYI at all the fan boys that preach Pulse audio. Yes it is a great system, and yes it works well – On systems that support it!
    Not all systems do, Take for example a Nebook, Low powered portable device designed for extended battery live aimed at users who want to surf the web and make Skype calls in a cafe etc.
    Pulse audio in my experience as a net-book user is an absolute no. It is clunky, and performs bad on the limited resources. Removing it and swapping it for something more lightweight is the only way to stop your sound coming through like a food blender. Until the frankly unfinished Pulse audio has an option to run on limited resources properly and efficiently, it is not a viable option for these devices.

  • The joy of choice. Thanks for the great info. I purged pulseaudio without a problem and setup ALSA per this How To. Works without issue. No more lock ups for just trying to change the volume. I do not care how great pulseaudio is, if it breaks my computer, it is worthless.

  • Thank you!!!! I managed to get my volume control back after switching to jackd. It is so nice to be able to just press the volume keys on my keyboard!! :-)

  • Thanks so much! This is EXACTLY what I was looking for, after removing the nothing-but-trouble, sh***y PULSEAUDIO. I’ve been running Ubuntu from 8.04 thru 10.10, and could never get PA working properly, and yes I tried every adjustment/config/tweak/suggestion that was out there, and it was nothing but a source of major frustration. I await the day when Ubuntu has PA as a choice ONLY if I want to install it, and not have it (and it’s many problems) forced upon me.
    Thank you for your help!

  • PusleAudio DOES cause latency, and it causes it in an inconsistent way. Sometimes when I use QSynth or Hydrogen, I get over 500 ms latency. Restarting pulse-audio can restore latency back to a very small and quite acceptable amount, and everything works perfectly, but at other times doing this causes the sound system to start getting crackles and pops, as if the audio buffers were under-running.

    Restarting Pulse also requires I restart things like Skype and whatever app I was using usually, because they dont necessarily reconnect to the sound server properly, so it’s a step I hate having to do. The thing is, doing other things like playing a game or a flash video can for some reason then cause PulseAudio to greatly increase latency for all apps, and I have to restart it again to make QSynth usable. Exactly why this happens is still a mystery to me, but it’s extremely annoying. I really wish PulseAudio was an opional install, because I dont need to be able to play audio over a network, or all that other stuff that Pulse audio does – I just need an audio mixer that allows me to have multiple apps producing sound, with low enough latency that a midi keyboard is usable. you know, like Windows and macs have been doing for 10+ years.

  • Thank you for this guide. I’m on Lucid and I was having the mic delay problem with PulseAudio (an old bug which still hasn’t been fixed). Now mic works without any delay, I have a decent channel mixer, a working panel applet and working keyboard shortcuts. After a few tweaks here and there to switch some stuff manually to ALSA, everything works.

    To the other comments: I have nothing against PulseAudio but I needed the mic to work properly. I did try all kinds of solutions and workarounds for days, Pulse didn’t want to work. Sorry, if ALSA works and Pulse doesn’t, I use ALSA, it’s that simple.

  • Thanks you for posting a working solution. There are so many solutions that don’t work it was nice to finally find one that does work! You made my day.

  • Does this work on 11.04?

  • Thank you for the how-to. I was just wondering how to get the tray icon like in your picture. After successfully following the procedure, my icon’s background is now light grey, which stands out against my panel’s dark background.

  • Has anybody figured out a way to remove the grey background on the icon? I’m using it with 11.04 and the old netbook remix UI (Unity is crap for netbooks too).

  • Thanks for this tutorial.

    Everything went fine but I don’t have volbar.py in the notification area and alsavol.py runs until I use one of the keyboard shortcuts and then stops. Re running it in terminal lets me use the shortcuts once more and then stops again. I should mention I’m running 10.10. Any ideas how to get it running permanently?

    Thanks in advance

  • Those people complaining how going to Alsa doesn’t do anything for them because they have perfect audio,why are you here? It works fine for you so leave it.I have been looking on the internet for solutions for why my LFE speaker is turned off after every song for hours and hours and never found a solution until now. I agree that it’s better not to go back to older ways but this is the only thing that works for me,I don’t have a very old computer and a fresh install of Ubuntu but the problem keeps coming back and I’m fed up.

  • This has been marked as an “attack site” in firefox and is flashing big warnings – I choose “ignore” – why?

  • I have tried may times to get Pulse Audio to work correctly, and have failed. Every distribution that uses it has the same problem. Multichannel sound simply refuses to work correctly, and if you can get all the channels to work, then recording from it fails. Many computers today come with HDA audio and Pulse Audio doesn’t seem to play nicely with it at all. Ubuntu 10.04 and up, broken. Removing it results in no way to control your sound under Gnome since ubuntu removed the ALSA applet for the panel and replaced it with a Pulse Audio only one. Using xfce-mixer instead is a possibility, does work, but is a poor band-aid solution to the problem. In Kubuntu (or KDE under Ubuntu), removing pulse audio will allow Kmix to properly see ALL the channels in the sound card and properly allow you to adjust each one by itself !!! In other distros this seems to not work. I’ve played around with linux since 1997 and am quite tired of having to “fix” things all the time. I wish the various distros would dump Pulse Audio and make ALSA more robust instead, since alsa HAS worked correctly for some time, and Pulse Audio uses it anyway, so what gives, why have two things doing the same thing ?? Oh well.

  • Pulse Audio is smooth and nice dealing with the most common apps around, but people start complaining when in need of realtime audio editing or multitrack recording. That’s the point, alsa drivers are still faster and the latency you get from them is the lowest you can aim at. There are no other ways at the moment !

  • VLC 1.1.10 and 1.1.11 in Ubuntu 10.04 have an audio lag delay of about 250ms. Instead of removing Pulse Audio, you could go into VLC’s preferences and change the “Default” audio output module to “ALSA” or “OSS”. This prevents dependency problems that might occur if Pulse Audio is removed.

  • Hi all

    I tried to use the kill command for pulseaudio as suggested above
    echo autospawn = no|tee -a ~/.pulse/client.conf && killall pulseaudio

    How can I reverse this as the alsa setup did not really work for me? Please could anyone help. Pulseaudio no longer starts properly and it stops often. Any help would be appreciated.

  • Hi Folks,

    As many of you guys, I encountered problems trying to run Pulseaudio along with my Soundcard. Uninstalling Pulseaudio related files fixed my problems but I did not quite like the applet solution. The missing hover function in Nautilus an other goodies were really missing.

    So i stumbled upon this neat little applet, which works just great and provides all usual futures people are used to. You simply can add the PPA and voilĂ , it all works just fine. The icon is downloadable from here: http://software.flogisoft.com/alsa-tray/en/

    Glad if I helped :D

    Regards,

    ubuntufreak

  • Thanks, I like the option just disable Pulseadio.
    Far as I know Pulsadio dose not support digital audio pass through. Until then I’ll disable it

    @Cris, tried to delete ~/.pulse/client.conf ?

  • I ment Passthrough

  • I’m absolutely appalled to see Xubuntu 11.10 with sound NOT working property out of the box. At one point the sound went silent. Mplayer looked like it was playing, but no sound. Same thing with youtube videos in Chrome. Tried every mixer setting. Tried rebooting. Tried deleting pulse audio settings files. It worked for a few minutes, but then it seemed that an app (mplayer2 + Chrome playing at the same time?) caused it to become broken with no way of fixing it. Angry and disappointed, I yet again uninstalled pulseaudio. I can not *believe* that the decision makers at Ubuntu are letting this all happen. Their attitude should be to ban pulseaudio until it’s properly working, and to tell the people defending it, that they are PLAIN WRONG – DEAD SIMPLE. There are NO EXCUSES FOR THIS ! Consider yourself all in the penalty box, PA developers!

  • Thank you so much! A ugly KDE- Upgrade installs me Pulseaudio and I hated it. So it’s wonderful.

    Thank you!

  • Between sound and issues and the terrible interface that Unity is, one has to wonder if the Ubuntu development effort all started drinking from the wrong Kool-Aid. It’s sadly embarrassing for those of us who have been encouraging the adoption of Ubuntu to be saddled with a release that is like stepping back 12 years.