Normalize XBMC media volumes with ALSA on-the-fly

Thursday, 24th November 2011

One problem with my ever growing collection of movies and tv is the volume wars between formats. Add in music video downloads from iTunes and Amazon and the variabations become extreme. With a little creative searching I found an addon that can be added to the ALSA sounds system on my Ubuntu installation to this work on-the-fly

Introduction

Having recently perfected my DVD -> Hard Drive workflow (I will have more on this, as soon as I have finished writnig it up) inevitably every type of file has its own volume level. So while I started looking for an addon to XBMC that would normalize the audio levels for both music and video I subbled apon 'ladspa'. So for my reference as much as anyone elses here is how I went about installing it and configuring XBMC to use the 'ladspa' device

Installation

Like most things the first step is to install the plugins for ALSA - On Ubuntu this can be done using apt-get install swh-plugins, other distros will have their own install commands

After the new ALSA addons are installed you need to set up a new device by editing the /etc/asound.conf file, now on most systems this file isn't needed so you may need to create one. So you can just copy and paste what I've used bellow:

  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";
      path "/usr/lib/ladspa";
      plugins [
          {
              label fastLookaheadLimiter
              input {
               #InputGain(Db) -20 -> +20 ; Limit (db) -20 -> 0 ; Release time (s) 0.01 -> 2
               controls [ 20 0 0.8  ]
              }
          }
     ]
  }
      

Now I am not sure if you need to restart the machine or if it is enought to just restart the application using the sound card, if you happen to know ether way please drop me a comment bellow and let us know. As things happened I rebooted anyway.

The final step is to get your programs to actually use this device. In XBMC you will need to go into the System Settings page and configure a custom audio device, for the device name you just need to put 'ladcomp' then XBMC will need restarted.

If your not a XBMC user you can still make use of this setup by telling your other application to use this sound device. In most cases this will ether be "alsasink device=ladcomp" or "ladcomp", if you have to use other variation let us know so we can try and make it as easy as possible for everyone to follow on.


Save & Share This...


Comments

No Comments Yet

Add new comment

Sanitized HTML

  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <pre>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.