My thoughts on Slackware, life and everything

Adding an ALSA software pre-amp to fix low sound levels

Low sound volume in Linux?

Apparently a lot of laptop users are confronted with the issue of very low sound levels – not just in Slackware. Note that this is different from the “sound can not be un-muted” issue I experienced and which I wrote about in a previous article.

If you are among the affected users for whom the sound levels remain too low even when cranking the volume all the way up, there is away around this.

It works by enhancing the ALSA sound system with a sound pre-amplifier and adding that to the available controls. ALSA uses dmix to create the new software volume control. You can then play around with varying percentages of sound amplification. You will have to find an optimum between acceptible sound levels and the possible sound distortion which will be introduced by this pre-amp.

To add the software pre-amp system-wide you need to open the ALSA configuration file “/etc/asound.conf” in an editor (Slackware does not create that file by default, so you may have to edit a new file) and add the following definition to it (note that if you have multiple sound cards and the default is not “card 0” you may have to alter the definition a bit):

pcm.!default {
        type hw
        card 0
}
ctl.!default {
        type hw
        card 0
}
pcm.!default {
        type plug
        slave.pcm “softvol”
}
pcm.softvol {
        type softvol
        slave {
                pcm “dmix”
        }
        control {
                name “Pre-Amp”
                card 0
        }
        min_dB -5.0
        max_dB 20.0
        resolution 6
}

Then, save the file and reboot your computer (you could also try running “/etc/rc.d/rc.alsa restart” but I can not guarantee that that will re-initialize ALSA correctly).

After reboot, you will find an additional control in your mixer (alsamixer or kmix) called “Pre-Amp”. Note that KDE’s mixer does not show all controls by default and you may have to add “Pre-Amp” to the visible controls.

Eric

Addendum:

Note that initially I suggested the use of the block of code you find below. But when I installed Slackware 14 on my new desktop I experiences the same volume level issue. After adding a “pre-amp” I found that ALSA had lost its default device, which caused warning messages every time I logged into KDE and gives programs like aplay and mpg123 the fits. A comment by “d” further down in the article with the above solution worked much better for my desktop machine, so I decided to re-write this article even though I don’t usually do such a thing. I will keep the originally suggested code block below for reference – try it only if the code above does not work for you:

pcm.!default {
      type plug
      slave.pcm "softvol"
  }

  pcm.softvol {
      type softvol
      slave {
          pcm "dmix"
      }
      control {
          name "Pre-Amp"
          card 0
      }
      min_dB -5.0
      max_dB 20.0
      resolution 6
  }

If the Pre-amp control does not appear in your mixer window, you may have to replace the line that says:

type plug

with this line:

type hw

This information was taken from the unofficial ALSA Wiki: http://alsa.opensrc.org/index.php/How_to_use_softvol_to_control_the_master_volume and it was also offered as a solution in this LinuxQuestions.org post on the Slackware forum.

I received a report that the default block of code does not always work. Changing “plug” to “hw” may be necessary with some laptops.

http://www.alsa-project.org/alsalogo.gif

24 Comments

  1. fogie

    Eric,

    Thank you *SO* very much for this. I have googled this for years! I can’t wait to give it a shot later on today.

    I tried OSS 4 from SBo as a trial for the netbook, and although it did make the acer AOA150 louder, I lost the sound for webcam, and resume from hibernate/suspend yielded no sound. I got lazy and gave up. I know this little netbook should go louder, as in Win XP the sound will practically knock you over, heh.

    This looks really promising, thanks for posting. 🙂

  2. escaflown

    Thanks for the tip, Eric! Doing this with KDE 4.5 rc3, the pre-amp doesn’t show up in kmixer. I was able to get through alsamixer in console.

  3. Desiderius

    I tried this tip on my laptop but it does not work !

    I have created the /etc/asound.conf with the line
    type hw

    but when I open alsamixer or kmix I do not see the Pre-amp control !

  4. dolphin77

    Reboot. Try alsaconf. In my case i had to return to plug. It worked for me.

  5. gregor

    Thanks a lot – this was an issue for quite some time.
    To show up on the mixer, the “speaker-test -D” from the wiki did the trick even without restarting alsa or reboot.

  6. fogie

    Hello Eric,

    No luck here for the acer aspire one AOA-150 netbook using slack –current. I tried on huge-smp and generic-smp but no luck 🙁

    Thanks again for posting. At least it appears to have helped some people out.

  7. fogie

    Eric !

    Great news! I decided to try this again since there has been quite a few changes in –current and I’m *HAPPY* to report this now works for me. 🙂

    It did not work at first. So I deleted my /var/lib/alsa/asound.state and than ran alsaconf. I figured “what the heck”.

    Suprisingly, alsaconf doesn’t see my sound card, I don’t know why exactly, but sound has always worked. It then prompts me for isapnp scanning and I just cancel that, reboot, and voila works everytime, though only once is needed 🙂

    Thanks again Eric!

  8. Marcus Wanner

    Hey, just wanted to let you know that this really helped me. I’d also like to point out that as is usually the case in linux, you don’t have to reboot. In fact, you don’t even have to do the /etc/init.d/alsa restart (all this does is save and then restore your mixer levels). You just close anything that’s playing sound as well as you mixer and then reopen it, and the new configuration is picked up when they go to play sound. Thanks again!

  9. Orakio "O Gagá" Rob

    Thanks thanks thanks! It worked on my Slackware 13.37! ^_^

  10. Xerop

    It doesn’t work for me yet. Thanks again for posting.

  11. claudio_o

    Thank you, I can finally hear something! 🙂 Debian Squeeze

  12. Gary

    Thanks Eric! It seems every Dell Laptop I have purchased to date needs the pre-amp applied.

  13. Avi Marcus

    Low volume has been bugging me for months. This worked after one reboot. Thanks!!!

  14. d

    I’ve got a new thinkpad that has Intel PantherPoint chipset for audio and neither ‘hw’ nor ‘plug’ works. I will keep searching for a solution and post back here if I find one. Thanks!

  15. d

    I found a solution that works with my new Thinkpad T530 with the PantherPoint chipset:

    pcm.!default {
    type hw
    card 0
    }
    ctl.!default {
    type hw
    card 0
    }
    pcm.!default {
    type plug
    slave.pcm “softvol”
    }
    pcm.softvol {
    type softvol
    slave {
    pcm “dmix”
    }
    control {
    name “Pre-Amp”
    card 0
    }
    min_dB -5.0
    max_dB 20.0
    resolution 6
    }

    A little different than what has been mentioned before, but it works!

  16. alienbob

    Hi “d”,

    Thanks for reporting back about your solution. I am certain that other people will profit from this.

    Cheers, Eric

  17. fgcl2k

    Hi,
    d’s solution worked for me too! The Pre-amp appears only in alsamixer and not in KDE but it works. For the first time in years I have decent volume on my laptop (Dell Latitude E6500) with Intel Corporation 82801I (ICH9 Family) HD Audio Controller.
    Thank you very much to you both.

  18. alienbob

    FYI – I have updated the main article, replacing my original ALSA pre-amp configuration with the lines as suggested by “d” in his comment on September 23, 2012.
    His configuration works much better than my initial suggestion and I hope that this opinion is shared by others who read this article – it is one of the most popular pages in the blog.

    Eric

  19. Lunix Usar

    I have this exact problems however none of the above code seems to get the Pre Amp to show up in alsamixer for me. This is pretty much the only advice that seems to even exist of the subject so im wondering if anyone knows anything else I can try?

  20. alienbob

    Someone on reddit complained that the above was too complex but he failed to write that complaint in a comment to my article. How are people supposed to learn that way?
    Anyway, this is what he suggested as a portable alternative:

    pcm.!default {
    type asym
    playback.pcm “plug:softvol”
    capture.pcm “plug:dsnoop”
    }

    pcm.softvol {
    type softvol
    slave.pcm “dmix”
    control { name “PCM”; card 0; }
    max_dB 32.0
    }

  21. RuddyMolina

    Thank you man, my slackware-current as it is 28 april 2015, was running well, but I was fighting to install warzone2100, openra, and other software and I ended fucking up the volume range.

    Thank you.

  22. Mathieu

    For some reason, only the “older” version seems to works on my dell xps 15.

    Didn’t try to figure out why.

    (it made me go crazy for some hours because i remembered using our blog some time before and it worked out of the box, that was why )

  23. SteveD

    Hi,
    I got this to work fine, but wondered what the “resolution” setting does? I was hoping it would alter the granularity of the Pre-Amp channel control in alsamixer, but it appears it does not.

    Does anybody know how to achieve that, at all?

  24. LesStrater

    Well… It took 4-hours, but I finally got this to work on my Dell laptop. The newer version didn’t work, so I used Eric’s original code, replacing the “plug” with “hw” as instructed. That created the Pre-Amp control in Alsa, but I completely lost all sound. The solution was to keep the original version, but replace the “slave.pcm “softvol”” line with “card 0” like is shown in the newer version. And don’t forget to do a “alsactl store” when you’re done to save your new settings. Thanks Eric!

Leave a Reply to alienbob Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2024 Alien Pastures

Theme by Anders NorenUp ↑