Thursday, June 14, 2012

How to add a pre-amp and increase maximum volume in alsa

NOTE:
Some things I've noticed after doing this:

-mplayer volume control no longer has any effect.
-my sound capture devices have stopped working (mic, mic jack, line in)
-preamp must be enabled at least 20% with below settings to produce any sound through pcm at all.

A common complaint with alsa is that PCM (wav) playback, even on maximum volume is too quiet.

I created /etc/asound.conf with the following paramaters:
I am running debian squeeze linux x64 edition..

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 -30.0
      max_dB 30.0
      resolution 6
  }

Save the file as root as /etc/asound.conf

Now open a test wav file in aplay:

aplay -D default file.wav

You may need to kill any PIDs using alsa, run (as root)

alsa reload

This will print all the PID's using alsa, e.g.



# alsa reload
/usr/sbin/alsa: Warning: Processes using sound devices: 2338(mixer_applet2) 3612(chrome).



Now when you open alsamixer or gnome-volume-control you should see a new volume control called Pre-amp: