Automatically adjust the volume based on content?
Adjusting sound level with a LADSPA plugin
To obtain a fairly normalized sound output level independent of the input level we may use a LADSPA-plugin to filter the sound output through PulseAudio.
- see also: How can I apply a LADSPA plugin to a PulseAudio stream?
As a minimum, we need a compressor plugin such as the dysonCompressor from the swh-plugins which need to be installed if not yet present.
After having found out the name of our default sink with
pacmd list-sinks
and the exact name of the plugin as it is stored in /usr/lib/ladspa/
(with my system here dyson_compress_1403
) we can issue the following command
pacmd load-module module-ladspa-sink sink_name=ladspa_sink master=<alsa_output> plugin=dyson_compress_1403 label=dysonCompress control=0,1,0.5,0.99
Replace <alsa_output>
with the exact name of the output sink (in my system this was alsa_output.pci-0000_00_14.2.analog-stereo
).
The compressed output can now be heard on the newly created output sink ladspa_sink
accessible from the Sound Settings menu.
Control settings for the compressor plugin are as follows: peak limit, release time, fast ratio, ratio. See in the plugin documentation for more details, defaults and minimal resp maximal values for these controls.
To avoid clipping of playback we may also combine this plugin with a limiter after compression. We may use the fast_lookahead_limiter
for this with the master sink being now our just created lasdpa_sink from above:
pacmd load-module module-ladspa-sink sink_name=ladspa_normalized master=ladspa_sink plugin=fast_lookahead_limiter_1913 label=fastLookaheadLimiter control=10,0,0.8
Source: settings above were adapted to pulseaudio from brien's blog on miscfits
Takkat's solution is good, but here's a variation which is simpler and permanent.
apt-get install swh-plugins
Cut and paste the following into a file called ~/.config/pulse/default.pa:
.nofail .include /etc/pulse/default.pa load-module module-ladspa-sink sink_name=ladspa_sink plugin=dyson_compress_1403 label=dysonCompress control=0,1,0.5,0.99 load-module module-ladspa-sink sink_name=ladspa_normalized master=ladspa_sink plugin=fast_lookahead_limiter_1913 label=fastLookaheadLimiter control=10,0,0.8 set-default-sink ladspa_normalized
Run
pulseaudio -k
or log out and back in again
Normalization will automatically be turned on for all subsequent logins.
Volume normalization is present in SMPlayer. Goto software center and download this awesome player, then enable volume normalization under audio options :)