or… how to tune your Alsa Stuff. Recently i had some trouble getting two apps working at the same time within Linux. The Problem can be solved using available Alsa-Sharing Howtos. A few days later i played around with the Equalizer of Audacious and realized that the music sounds a lot nicer with a “rock” preset within audacious. The thing is… This new sound “effect”/”settings” apply only for Audacious – But i want them for the whole System. So what? Let’s look how to improve Sound using Alsa. If you use ladspa, there’s a equalizer which we could use. The problem with it is, it got 15 bands, my player got only 10. That means i have to refine the settings. Lets put it together in a table:
Note: For this working you will need some Ladspa plugins! Check Links at the bottom of the page.
Rock preset
Ladspa Equ | Equ Setting | Audioplayer | AP Settings ---------------------------------------------------------------------- 50 Hz | 6 | 60 Hz | 8 100 Hz | 4.4 | | (6.4) 156 Hz | 2.8 | 170 Hz | 4.8 220 Hz | 0.4 | | (0.4) 311 Hz | -5.6 | 310 Hz | -5.6 440 Hz | -7.2 | | (-7.2) 622 Hz | -8 | 600 Hz | -8 880 Hz | -3.2 | 1000 Hz | -3.2 1250 Hz | -2.4 | | (-2.4) 1750 Hz | -1.6 | | (-1.6) 2500 Hz | 4 | 3000 Hz | 4 3500 Hz | 8.8 | 6000 Hz | 8.8 5000 Hz | 10.2 | 12000 Hz | 11.2 10000 Hz | 10.2 | 14000 Hz | 11.2 20000 Hz | 10.2 | 16000 Hz | 11.2
¹) Stuff within brackets ( ) in “AP Settings” are middle-values between the last and the next known one.
²) Stuff within “Equ Settings” are settings which sound good to me.
³) Theres still a bit fine tuning needed, for me the bass is sometimes a bit “high” – All in all it sounds crystal clear here, most will like that. though you should note: software equalizer will sound different from computer to computer and from speaker to speaker.
Allright. I’ve seen that the “rock preset” within audacious (i’ve token that preset from xmms) is using preamp -1.11. For that i will use the ladspa amp plugin:
Ladspa
No idea about Ladspa? Check the Links at the bottom of the page – they will explain it clearly.
# run the simple amplifier on it
pcm.amp {
type ladspa
slave.pcm "equ";
path "/usr/lib/ladspa";
plugins [
{
label amp
input {
# -1.11022e-15
controls [ -1.11 ]
}
}
]
}
# and now let the equalizer have fun with it.
pcm.equ {
type ladspa
slave.pcm "plughw:0,0";
path "/usr/lib/ladspa";
plugins [
{
label mbeq
input {
controls [ 7 6.4 4.8 0.4 -5.6 -7.2 -8 -3.2 -2.4 -1.6 4 8.8 10.2 10.2 10.2 ]
}
}
]
}
Now play your with mpg123 normally and after 30 seconds with -a plug:ladspa or -a ladspa. You will hear the difference. Our “equalizer” should work now :)
Now we need this per default, without using -a and without telling which device to use, and we need alsa-sharing so that we can play many sounds at the same time.
For that we will use dmixing and define some general stuff within the .asoundrc:
Dmix
### dmix stuff
pcm.dmix0 {
type dmix
ipc_key 673138
ipc_key_add_uid false
slave {
pcm "hw:0,0"
rate 44100
period_size 2048
buffer_size 8192
}
bindings {
0 0
1 1
}
}
pcm.asym0 {
type asym
playback.pcm "amp"
capture.pcm "hw:0,0"
}
Now change slave.pcm “plughw:0,0″; in equ to: plug:dmix0. If you now use -a asym0 or -a plug:asym0 it will go through amp, equ, dmix0 – As we wanted it. Now let’s make this by default without using -a by adding the following:
General Stuff
### The general stuff
# 'dsp0' is espected by OSS emulation etc.
pcm.dsp0 {
type plug
slave.pcm "asym0"
}
ctl.dsp0 {
type hw
card 0
}
pcm.!default {
type plug
slave.pcm "asym0"
}
ctl.!default {
type hw
card 0
}
Done. Now all sounds on your box are “routed” through the amplifier, the equalizer and dmix. Anyway. The whole configuration file? Here you go lazy guy:
The whole configuration
###
# Teh wonderful .asoundrc
###
# sound -> asym0 -> ladspa(amp) -> ladspa(equ) -> dmix0 -> hw0,0
### The ladspa stuff
# run the simple amplifier on it
pcm.amp {
type ladspa
slave.pcm "equ";
path "/usr/lib/ladspa";
plugins [
{
label amp
input {
# -1.11022e-15
controls [ -1.11 ]
}
}
]
}
# and now let the equalizer have fun with it.
pcm.equ {
type ladspa
slave.pcm "plug:dmix0";
path "/usr/lib/ladspa";
plugins [
{
label mbeq
input {
controls [ 7 6.4 4.8 0.4 -5.6 -7.2 -8 -3.2 -2.4 -1.6 4 8.8 10.2 10.2 10.2 ]
}
}
]
}
### dmix stuff
pcm.dmix0 {
type dmix
ipc_key 673138
ipc_key_add_uid false
slave {
pcm "hw:0,0"
rate 44100
period_size 1024
buffer_size 4096
}
bindings {
0 0
1 1
}
}
pcm.asym0 {
type asym
playback.pcm "amp"
capture.pcm "hw:0,0"
}
### The general stuff
# 'dsp0' is espected by OSS emulation etc.
pcm.dsp0 {
type plug
slave.pcm "asym0"
}
ctl.dsp0 {
type hw
card 0
}
pcm.!default {
type plug
slave.pcm "asym0"
}
ctl.!default {
type hw
card 0
}
Useful Links
- Ladspa at unofficial alsa Wiki
- Dmix at unofficial alsa Wiki
- Alsa Sharing at unofficial alsa Wiki
- Low-pass filter for subwoofer channel HOWTO at unofficial alsa Wiki
- Ladspa Homepage
- Some Ladspa Plugins (i used amp and mbeq from there)
