= Alsa Volume Boost = ALSA is really powerful, but mastering this power can be tricky. == Install some alsa shit == I had to install those, because they were missing from my system. {{{ apt-get install alsa-oss alsaplayer mpg321 alsaplayer-alsa alsa-base }}} == Interesting shits to read and try == To get a list of possible devices, you may use: {{{ aplay -L }}} To test devices, use: {{{ speaker-test -D -c -twav }}} If that command produces sound on the correct channels and you can use it on two different consoles simultaneously, you can use this device. If simultaneous usage doesn't work, see dmix and Hardware mixing, software mixing to enable software mixing. So I created a new softvol device putting this into '''/etc/asound.conf''': {{{ pcm.softvol { type softvol slave { pcm "front" } control { name "PuttanaEva" card 0 } } }}} This will create a new PCM device called softvol, which is controlled by a volume control "PuttanaEva" and which will pass the sound data with the changed volume to its slave "front". You have to replace "front" with the name of the device you determined above and "PuttanaEva" with what you want to call your new volume control, e.g. SoftMaster. If your card does not have a master volume control at all, you're lucky, because you can name your new volume control Master and your new control works like a master volume control is supposed to. To find out, whether such a control exists, run: {{{ amixer controls | grep Master }}} If this command lists a control named Master, you should not name your new control like this. Unfortunately, existing controls can't be overwritten, so you have to pick a name like SoftMaster. This control will now control everything, but as it is not called Master, mixers (like KMix) won't use it to control master volume, unless you can make them choose another control (like GMix). The name you give to your control matters a lot. Some suffixes have special meanings. For example, if you want your softvol to control the playback volume only, the control name must end with Playback Volume. Such a name prevents the mixer from showing it as a capture control. Now test your new device with: {{{ speaker-test -Dsoftvol -c -twav }}} (channel count is 2 for me} '''Note: The new volume control won't appear immediately! Only after the first usage of the newly defined device (e.g. with the command above, or playing some mp3), should amixer controls | grep display your new control. Mixers that were already started before the first usage (like KMix) have to be restarted to adopt the changes. If you still don't see the new control, try restarting ALSA or your PC: for me is /etc/init.d/alsa-utils restart. And / Or reboot your machine.''' For the rest of the examples, please check http://alsa.opensrc.org/How_to_use_softvol_to_control_the_master_volume == Let's do the trick == === Softvol === This is the page about the softvol plugin, an ALSA plugin that allows the user to add a new volume control and control the sound volume or parts of it by software. This is often necessary if the sound card can't control the volume by hardware. Another usefull thing you can do is control the volume of every application seperatly, even if the application can't do it on its own. === Basic usage === A basic configuration in /etc/asoundrc file looks like this: {{{ pcm.newdevice { type softvol slave.pcm "default" control.name "Softmaster" control.card 0 } }}} This creates a new PCM device called newdevice whose volume is controlled by a new volume control called Softmaster. The audio stream with changed volume will be passed to the default device. As the plugin doesn't change anything but the volume, sample format, sample rate and number of channels of the new device are equivalent to the values of the slave. '''It is not possible to redefine a non user defined control!''' If the name of the new volume control already exists, the new device just copies the stream to its slave without changing anything. Use amixer controls | grep Softmaster to find out whether the control already exists. However, it is possible to create a control named "Master" to get a proper master volume control if the soundcard does not have one itself. See How to use softvol to control the master volume. '''Note:The new volume control won't appear immediately'''! Only after the first usage of the newly defined device (e.g. with speaker-test), should amixer sget Softmaster display the new control. Mixers that were already started before the first usage (like KMix) have to be restarted to adopt the changes. If the new control is still not there, try restarting ALSA or your PC. I already told you this. == Removing a volume control == '''This task is not as easy at it seems, if you don't know the trick.''' If the correspondant part of the configuration file is just deleted and alsactl store has been executed after the usage of the device in question, the volume control won't disappear. alsactl store stores the value of all controls (among them the softvol device) in /etc/asound.state (For me the correct file is '''/var/lib/alsa/asound.state''') and is most likely executed on every shutdown of your computer. To make the volume control disappear finally, '''you have to delete its values in /whatever/asound.state or just the whole file''' (it will be recreated with default values on next reboot). '''After that, your computer has to be restarted once without the execution of alsactl store on shutdown. On Debian, this can be achieved by temporarily renaming /etc/rc6.d/K50alsa-utils (or similar). Pressing the reset button also works, but should be avoided.''' So, to REMOVE a volume control: * edit /var/lib/alsa/asound.state and delete the volume control section of what you need to remove * RENAME /etc/rc6.d/KXXalsa-utils (or similar) to FUCKYOU-KXXalsa-utils * reboot * RENAME back /etc/rc6.d/FUCKYOU-KXXalsa-utils to KXXalsa-utils or whatever it was. == The complete /etc/asound.conf I'm using now == After some tries, reboots, deleting of files etc, this is now working for me: {{{ pcm.softvol { type softvol slave { pcm "front" } } pcm.!default { type plug slave.pcm "softvol" } pcm.softvol { type softvol slave { pcm "dmix" } control { name "PuttanaEva" card 0 } min_dB -30.0 max_dB 30.0 resolution 20 } }}} == Notes == Alsaplayer is very nice to test shit. For example: {{{ alsaplayer -o alsa -d plug:dmix somemusic.mp3 }}} so you can test that the dmix part of alsa you just configured is working correctly. == References == http://igmrlm.blogspot.it/2012/06/how-to-add-pre-amp-and-increase-maximum.html http://alsa.opensrc.org/How_to_use_softvol_to_control_the_master_volume http://alsa.opensrc.org/Softvol Asbesto ---- CategoryMuseo