Alsa & Pulseaudio in Mint 16

Discussion in 'General Linux Discussion' started by booman, Jan 31, 2014.

  1. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    I've read many posts about Ubuntu, Wine and audio problems. Unfortunately I have inherited these audio issues and they are causing problems in Borderlands 2. Previously in Mint 14 I never had issues with audio at all. Almost every game I ran the audio was perfect. What changed?

    When I run Borderlands the frame rate suffers and as I continue playing the audio eventually gets very "static" and "inaudible" meanwhile the framerate increases back.

    Alsa is having an issue and here is the output error.
    Code:
    ALSA lib pcm.c:7843:(snd_pcm_recover) underrun occurred
    I have done a bit of research and lowered the sample rate to 44.1 khz but I had to do it with a conf file.
    Looks like the settings didn't take because next time I started up Mint or Openbox, the problem is right back.

    Is there a better way to solve this problem?
  2. Daerandin

    Daerandin Well-Known Member

    Joined:
    Oct 18, 2013
    Messages:
    1,157
    Likes Received:
    258
    Trophy Points:
    83
    Location:
    Northern Norway
    Home page:
    I don't have much experience with issues of this sort. I am using PulseAudio and Alsa on Arch without any issues. You may want to ask on the Mint forums, it could possibly be just a bug in the current versions used by Mint which could be fixed by a regular update.

    In any case, I would strongly suggest you install pavucontrol

    The default sound settings available in Mint (and Ubuntu) are pretty useless in my opinion. pavucontrol is the graphical config for PulseAudio. It will let you properly configure all your sound devices, and even set different sound output to different devices on the fly.

    On Ubuntu, my Razer Megalodon headset was not properly recognized. The microphone did not work, but with pavucontrol I could set the correct settings for my headset and it would work without issue. So maybe try changing the configuration for your speakers/headphones on the settings for pavucontrol and see if it helps.
  3. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    Awesome! I'll check out pavucontrol and report back here.
    Thanks
  4. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    pavucontrol is a nice GUI for selecting inputs & outputs, but didn't have any control over Alsa or Pulsaudio.

    I did find an interesting command:
    Code:
    alsamixer
    Kinda does the same thing, but I think its control for Alsa only.
  5. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    I have to mention that I've had audio problems in the past with Mint 13. It would always default to my GeForce 550 Ti HDMI audio instead of the analog audio onboard my motherboard.
    So I would have to go to settings/audio and reset it over and over.
    Mint 14 on the other hand, never had a problem. So I can't wait for Mint 17!!!!
  6. Daerandin

    Daerandin Well-Known Member

    Joined:
    Oct 18, 2013
    Messages:
    1,157
    Likes Received:
    258
    Trophy Points:
    83
    Location:
    Northern Norway
    Home page:
    Did you check the "Configuration" section in pavucontrol? This is where you can set the profile for each device. I realize this is really just a shot in the dark, but it did solve my audio issues. Not to mention, the "Output" section also lets you define your default audio device.
  7. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    Yeah, I'm pretty sure. I tried all of the tabs. I'll look again.
    Even after using "alsamixer" I'm still getting that buffer underrun error.
    So annoying.
    I think its affecting the performance in my games too.
  8. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    I found this post on WineHQ's
    I know pulseaudio is already installed. Is that the same as pulseaudio-alsa?

    I also noticed in my system monitor that pulseaudio has "High Priority" when everything else is "Normal Priority"
  9. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
  10. Daerandin

    Daerandin Well-Known Member

    Joined:
    Oct 18, 2013
    Messages:
    1,157
    Likes Received:
    258
    Trophy Points:
    83
    Location:
    Northern Norway
    Home page:
    pulseaudio-alsa is a package in Arch Linux (and obviously Manjaro too) that makes PulseAudio and Alsa play nice together. I don't know if other distros have a similar package available.
  11. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    Doubtful, what about my last post? Do you think this "work-around" makes sense?
    I'm not adding it to my guides, but will only apply it to my machine
  12. Daerandin

    Daerandin Well-Known Member

    Joined:
    Oct 18, 2013
    Messages:
    1,157
    Likes Received:
    258
    Trophy Points:
    83
    Location:
    Northern Norway
    Home page:
    You can go ahead and try. Just make sure that you make a copy of all files you edit, in case this does not work properly in Mint.

    But in any case, if you have the time then I strongly suggest you possibly open a bugreport for Mint if there is not one already. It could be a problem with how things are set up in Mint, or the version of Pulseaudio that mint currently use could be problematic.
  13. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    I will probably try over the weekend. I will copy any files that get modified in the process.
    This is actually an Ubuntu 13.10 Saucey problem. I've read many posts about it on different sites.
    Mint 16 is based on that version of Ubuntu and apparently inherited the problem.
    All I know is... soon as Mint 17 is released, I'm upgrading.
  14. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    Guess what!!! It worked!
    I didn't have to back up anything because I did the changes on a user basis not system wide.
    So the changes only apply to my user account.
    Ironically I don't even know if I did it right, but Two Worlds runs much smoother and no "buffer underrun" errors.
    Who knew?
  15. Daerandin

    Daerandin Well-Known Member

    Joined:
    Oct 18, 2013
    Messages:
    1,157
    Likes Received:
    258
    Trophy Points:
    83
    Location:
    Northern Norway
    Home page:
    Great! Glad to hear it solved your problems. I have yet to experience any issues, but I'll keep this in mind if I encounter any problems.
  16. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    I'll continue checking for those buffer errors.
    They actually cause the game frame rates to stutter. Totally annoying.
    I even noticed it in another game.
    I hope Mint 17 will have this fixed.
  17. allenskd

    allenskd Active Member

    Joined:
    Feb 5, 2014
    Messages:
    510
    Likes Received:
    52
    Trophy Points:
    28
    Hey people,

    I've been working on improving the original http://wiki.winehq.org/WineAndPulseaudio

    I spent a few hours trashing WINE and Guild Wars 2 until I got the correct settings. I finally was able to have the power of pulseaudio's mixing (move audio output sources which was extremely important for me) and maintain everything through dmix.

    I'm still testing it, the fix is actually easy to implement and probably system-wide. I'm extremely happy about it, I've been seeing a lot of positive results.

    To those curious, this is a dirty fix with no explanation.

    Open /etc/pulse/default.pa with your favorite text editor

    We are going to comment(disable)
    - module-udev-detect
    - module-detect

    Final result would be this:

    Code:
    ### Automatically load driver modules depending on the hardware available
    #.ifexists module-udev-detect.so
    #load-module module-udev-detect
    #.else
    ### Use the static hardware detection module (for systems that lack udev support)
    #load-module module-detect
    #.endif
    
    In the original tutorial we see that the person adds the following lines
    Code:
    load-module module-alsa-sink device=dmix
    load-module module-alsa-source device=dsnoop
    
    What we are going to do here is the following:

    Code:
    cat /procs/asound/cards
    It'll print something like this (it DOESN'T HAVE TO BE SIMILAR):

    Code:
    [127]david@david-desktop:~ > cat /proc/asound/cards
    0 [PCH            ]: HDA-Intel - HDA Intel PCH
                          HDA Intel PCH at 0xfb400000 irq 52
    1 [NVidia         ]: HDA-Intel - HDA NVidia
                          HDA NVidia at 0xfb080000 irq 17
    2 [MicroII        ]: USB-Audio - Audio Advantage MicroII
                          C-Media INC. Audio Advantage MicroII at usb-0000:06:00.0-1, full speed
    
    The numbers in the left is the device_id of each of those soundcards. 0 being the default onboard card.

    In my default.pa I have the following loaded.
    Code:
    load-module module-alsa-sink device=dmix
    load-module module-alsa-sink device_id=1 #if you notice they are the same IDs we just printed
    load-module module-alsa-sink device_id=2
    load-module module-alsa-source device=dsnoop
    
    So what exactly did we do? I'm not sure if I'm correct, but if you load the modules in order, the first one will be the default one. This means we are not letting pulseaudio hog the hardware, which is perfect for us.

    Everything is going through dmix. And since pulseaudio has control over other hardware we just registered, we can easily switch sources without affecting the game's audio source.

    I have to do some more poking, but after 2-3 hours testing this... I'm having a good feeling about it. I'll post a little how-to and hopefully cross post it to PoL forums to help others. No more underrun!
  18. Daerandin

    Daerandin Well-Known Member

    Joined:
    Oct 18, 2013
    Messages:
    1,157
    Likes Received:
    258
    Trophy Points:
    83
    Location:
    Northern Norway
    Home page:
    Thanks for posting this! I'm sure this might prove very helpful to people experiencing issues. I would be glad to give this a try, except I've had no issues at all on my system so I will leave things as they are.
  19. booman

    booman Grand High Exalted Mystic Emperor of Linux Gaming Staff Member

    Joined:
    Dec 17, 2012
    Messages:
    8,339
    Likes Received:
    624
    Trophy Points:
    113
    Location:
    Linux, Virginia
    Home page:
    Thanks Allen for your tips and troubleshooting.
    Can you update your post here as well?

Share This Page