Tuesday, December 20, 2016

Audio Volume Normalizer

When I switched from MS Windows to Linux as my primary desktop, I found that I needed to adjust the audio volume frequently. For example, different YouTube videos have different levels of audio volume, but I didn't notice this in MS Windows. With some searching on the web, I found that MS Windows did some tricks behind the scene, called "Loudness Equalization".

Do we have similar ticks in Linux? After some digging on the web, I found the solution. In the following, I will show you how I do that in my XUbuntu 16.04 LTS box:
  1. First of all, need to install "swh-plugins". Actually, we only need the Compressor Plugin.
    sudo apt-get install swh-plugins
    I am not an expert on Sound Engineering, but I found a page which explained the parameters well.
  2. Next, we need to config PulseAudio to load the plugin and set the "default sink". To do this, create a file at $HOME/.config/pulse/default.pa with below contents:
    #include system-wise config
    .include /etc/pulse/default.pa
    
    #compressor -- for normalize audio volume
    .ifexists module-ladspa-sink.so
    .nofail
    load-module module-ladspa-sink sink_name=ladspa_out plugin=sc1_1425.so label=sc1 control=3,401,-30,4,5,12
    set-default-sink ladspa_out
    .fail
    .endif
    
  3. Then, you just need to kill PulseAudio daemon to restart with the new config:
    pulseaudio -k
  4. If everything goes well, you can run any application with audio playback (e.g. Mpalyer). To confirm the setup, you can run "pavucontrol" command to bring up the "Volume Control" GUI. In the "Volume Control" GUI you should see "SC1" plugin is being used, like:
References:

No comments: