Kodi Community Forum
Audio compressor and limiter - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: Audio compressor and limiter (/showthread.php?tid=35458)



Audio compressor and limiter - TobiasTheCommie - 2008-08-01

I was talking in the forum about dynamic range compression(which sometimes comes in handy) in the chatroom.

I was told it was planned, but not implemented yet.

Searching for a temporary solution i found out it was possible to do it through Alsa..

Since there is no need to invent the wheel twice, maybe it would be better to implement it in xbmc to just use the Alsa plugin..

According to
http://alsa.opensrc.org/index.php/Ladspa_(plugin)

what is needed is the following in the .asoundrc
Code:
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  ]
              }
          }
     ]
  }
And then tell the program to use the output "alsa:device=ladcomp".

I don't know how your feeling are about an implementation like this. But i would think it was fine to have xbmc update "/etc/asound.conf" on install(or rather, have the package manager do it), possible call it "xbmcCompression" instead of ladcomp. And then it is a simple toggle in the GUI to enable or disable it(choose which output to use).

It seems rather easy and doable to implement it this way. But i don't know if it is against any current guidelines.

Also, since some(many?) distro's are moving to pulseaudio, this might just be a temporary solution, i haven't found any compressor or limiter for pulseaudio, but that doesn't mean it isn't there.

Sincerely
Tobias Ussing


- TobiasTheCommie - 2008-08-01

Sorry, it was indented in the quotebox, dont know why it isn't in the final post.


- TobiasTheCommie - 2008-08-01

If this is an acceptable implementation i'm willing to give it a go.


- pike - 2008-08-01

Not acceptable for me, for one thing it's not cross platform.


- topfs2 - 2008-08-02

I think it's probably better to add an EffectChain between DVDPlayer/PAPlayer and the Audio Callback, either by creating a real EffectEngine or just the needed Effects. Also we could probably use our DllLoader to make it pluginable, This would make it crossplattform.


- TobiasTheCommie - 2008-08-02

and sadly, that is beyond my ability i am sure.

And didn't think about crossplatform, that should have been obvious to me.

Oh well.