You are not logged in.
Just a quick tip to get a normalizer device with Alsa and LADSPA. This benefits everyone who wants to watch videos and listen to audio normalized (I believe others might call it "ranged", 'compressed' or "limited") so that you don't have to worry about sound volume being too soft, or too hard, or has too much difference between low and high output.
First, install ladspa and plugins.
pacman -S ladspa-plugins
Then, add the following to your ~/.asoundrc
pcm.ladcomp {
type plug
slave.pcm "ladcomp_compressor";
}
pcm.ladcomp_compressor {
type ladspa
slave.pcm "ladcomp_limiter";
path "/usr/lib/ladspa";
plugins [
{
label dysonCompress
input {
#peak limit, release time, fast ratio, ratio
controls [0 1 0.5 0.99]
}
}
]
}
pcm.ladcomp_limiter {
type ladspa
#slave.pcm "plughw:0,0";
slave.pcm "pcm.1";
path "/usr/lib/ladspa";
plugins [
{
label fastLookaheadLimiter
input {
#InputGain(Db) -20 -> +20 ; Limit (db) -20 -> 0 ; Release time (s) 0.01 -> 2
#also possible... 20 0 0.8
controls [ 10 0 0.8 ]
}
}
]
}
pcm.1 {
type plug
slave.pcm "hw:0"
}
ctl.1 {
type hw
card 0
}
Now, if you use mplayer -ao alsa:device=ladcomp you will have maximum sound. Fiddle with the settings a bit and notice the commented options if things don't work for you. I have posted this on the alsa wiki ages ago, but just got the idea to put it on here as well.
Please let me know if you used this and share if it's working for you.
Don't blow up your speakers. ...
Last edited by voidzero (2010-06-16 17:57:36)
Offline
Worked perfectly. For those of you using XBMC, make sure to change your custom audio output to "ladcomp" to get it working.
for audio over HDMI http://forum.xbmc.org/showthread.php?t= … ht=ladcomp
Last edited by kvn (2010-10-02 02:41:25)
Offline
I always used fastLookaheadLimiter alone with mplayer compiled with ladspa support (check -af ladspa), but that alsa chain is great!
What's the advantages of putting the compressor too before the limiter?
Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !
Offline
I am having trouble using this with anything other than stereo input. I narrowed it down to fastLookaheadLimiter not working properly, but I have no idea how to fix the problem. If I feed it 6-channel audio, I can hear the correct audio quietly behind very loud and regularly-oscillating noise. Has anyone else experienced this and found a solution? The issue can be reproduced using the following command:
speaker-test -D ladcomp -c 6 -t wav
Can anyone else confirm this with their setup? I would love to find a solution to this.
Thanks!
--> You never heard of a walking towel? <--
Offline
this script works like a charm. however, after i reboot, all sounds are gone.
removing $HOME/.asoundrc and sudo rc.d restart alsa brings the sound back.
is there anything wrong?
Offline
Based on what you said I don't know, not enough info.
Have you configured alsa to save/restore your mixer settings? (/etc/conf.d/alsa)
Other possibility is, are you using pulseaudio? Pulseaudio can work with the ladspa settings I posted two years ago but it requires a bit of asoundrc tweaking. I'll have to dig up those settings but am short on time, let me know if you need those settings and I'll get back on that - I'll be notified of new comments.
(By the way, to the previous comments - I never saw a topic reply notification and totally forgot even making this post. Sorry, glad it worked for you )
Last edited by voidzero (2012-04-29 19:48:22)
Offline
i have alsa in my DAEMONS array in /etc/rc.conf, i thought that's a dummy daemon that save and load my alsa settings.
between the reboots, i may have pulled out the headphone. and pacman -Syu-ed.
i am not using pulseaudio.
i ran alsamixer, which seems perfectly ok while i still can not get any sound, and moved back the .asoundrc file, and restarted alsa daemon, and then everything is working again. that's really wired.
thank you for your kind attention.
$ cat /etc/conf.d/alsa
# Arguments for alsactl
# example: ALSA_ARGS="--file /var/lib/alsa/asound.state"
ALSA_ARGS="--file /var/lib/alsa/asound.state"
# Enables powersaving mode for AC97 and hda_intel audio chips.
# Set to 1 to enable powersaving.
# Set to 0 to disable powersaving (default).
POWERSAVE=0
# Whether to save volume levels when stopped ("yes" or "no").
SAVE_VOLUME="yes"
# Whether to mute the master volume when stopped ("yes" or "no").
# Useful for bad audio cards which make a noise on system poweroff.
MUTE_VOLUME="no"
Offline
Alright, that's some useful info. Let's look further.
Are you using the exact asoundrc as I posted in the first post or have you made changes? (and, do you have an /etc/asoundrc.conf or something similar?)
What soundcard do you have?
I have two cards, one has "enable automute" which mutes my speakers when I use headphones... but often it does not switch 'enable automute' back off when I unplug them. My other card has some optical toggler, if I enable that, all sound is muted too.
If restarting alsa is enough to have a working sound card you could also try to set 'SAVE_VOLUME' to 'no' and, while your sound is working, try to issue 'alsactl store' to manually save the settings.
Just some ideas from the top of my head while visiting family, so I am still a bit short on time.
Offline
i am using almost the exactly same asoundrc as you posted. i just removed the extra leading space from the last two sections. except that, everything else is identical.
i don't have a /etc/asoundrc.conf file.
$ lspci -v | grep audio
00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 03)
seems i also have the "automute" feature. when i plugin the headphone, the speaker is muted. but the speaker will get sound when i unplug the headphone.
i don't think the problem resides in storing the volume, because even when i have trouble getting sound, both the xfce4-mixer and alsamixer show the correct volume on all controls.
Offline
AUDIOOUT: [AO_ALSA] alsa-lib: pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM ladcomp
AUDIOOUT: [AO_ALSA] Playback open error: No such file or directory
AUDIOOUT: Failed to initialize audio driver 'alsa:device=ladcomp'
CPLAYER: Could not open/initialize audio device -> no sound
?
FIXED: .asoundrc was in the wrong place...
Last edited by el mariachi (2012-04-30 08:07:58)
Offline
00:1b.0 Audio device: Intel Corporation 82801JI (ICH10 Family) HD Audio Controller
That's my sound card.
AugustePop with which program are you trying to play sound? Mplayer?
In pcm.ladcomp_limiter you could try to fiddle with slave.pcm, I'm running out of ideas...
Offline
sound in flash is messed up using your config. Mplayer and mpd are perfect. any fix?
Offline
AugustePop with which program are you trying to play sound? Mplayer?
In pcm.ladcomp_limiter you could try to fiddle with slave.pcm, I'm running out of ideas...
whenn the problem occurs, both mplayer and audacious lost sound. actually, i don't know if anything else is still working.
after several tests and reboots, the problem seems went away. i have no idea how it fixed itself. but it seems alright now, with all the settings the same as when it went wrong.
i mysteriously missed the previous subscription mail from the forum. anyway, thank you for your help.
Offline
hope no one minds re-activation of an old thread - I have an on-topic question
Did the method of getting pulseaudio working with this ever show up?
Offline
hope no one minds re-activation of an old thread - I have an on-topic question
Did the method of getting pulseaudio working with this ever show up?
Yeah, I have it working with pulseaudio now. Be sure to delete the stuff from asoundrc, however, you can add something to asoundrc to make pulseaudio the default device:
pcm.pulse {
type pulse
}
ctl.pulse {
type pulse
}
pcm.default pcm.pulse
ctl.default ctl.pulse
Now, for Pulseaudio. Find out the name of your default device with pacmd list-sinks. Mine is "alsa_output.pci-0000_05_01.0.analog-surround-71".
Then, add the following to /etc/pulse/default.pa:
load-module module-ladspa-sink sink_name=ladspa_output.fastLookaheadLimiter label=fastLookaheadLimiter plugin=fast_lookahead_limiter_1913 master=alsa_output.pci-0000_05_01.0.analog-surround-71 control=20,0,0.3
load-module module-ladspa-sink sink_name=ladspa_output.dysonCompress label=dysonCompress plugin=dyson_compress_1403 master=ladspa_output.fastLookaheadLimiter control=0,0.5,0.5,0.99
set-default-sink ladspa_output.dysonCompress
You can test it first: preface every line with pacmd and execute: pacmd load-module module-ladspa-sink ... etc.
Good luck!
Offline
thanks - initial impression is it's reducing clipping and distortion and keeping volume up.
small hint for anyone that finds this later - when I put the above suggested load-module/set-default in
~/.config/pulse/default.pa
pulseaudio dumps core. Works fine in /etc
I wanted to put it in ~/.config so I would not have to deal with the /etc version changing every time pulseaudio is updated.
in my setup pulseaudio also dumps core with those entries in ~/.asoundrc. I had forgotten I had this in my /etc/asound.conf to get the mozilla flash plugin working
# Use PulseAudio by default
pcm.!default {
type pulse
fallback "sysdefault"
hint {
show on
description "Default ALSA Output (currently PulseAudio Sound Server)"
}
}
ctl.!default {
type pulse
fallback "sysdefault"
}
# vim:set ft=alsaconf:
Last edited by Sanjeev K Sharma (2013-10-24 17:05:34)
Offline