Audio compressor and limiter
#1
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
Reply
#2
Sorry, it was indented in the quotebox, dont know why it isn't in the final post.
Reply
#3
If this is an acceptable implementation i'm willing to give it a go.
Reply
#4
Not acceptable for me, for one thing it's not cross platform.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#5
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.
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#6
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.
Reply

Logout Mark Read Team Forum Stats Members Help
Audio compressor and limiter0