Volume limiter in git...

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
PatrickBateman Offline
Posting Freak
Posts: 1,676
Joined: Mar 2011
Reputation: 17
Location: Another Earth
Post: #1
Hey,

Just checked here:
https://github.com/xbmc/xbmc/tree/31e6e5...69d62d8432
and apx 2 hours ago it seems the 8 year old ticket was closed with the following description.

Added: simple dynamic range compression, a volume amplification slider is now available in the audio and subtitles dialog, which can be used to increase the video volume, a limiter is turned on to prevent clipping.

This limiter is also enabled when a downmix configuration can produce clipping, for example when boost volume on downmix is turned on.

The limiter's hold and release times can be configured through advancedsettings.xml.


Now, originally I think the ticket was opened as a DRC option for DTS etc and from what the description says, I'm a tad confused? Is this DRC for DTS/AC3 bitstreams etc or is this something else?

Can anyone shed any light on this for me, how it will function in the real world, does it amplify quiet sounds to a set db and limit loud sounds to a set db etc..

The description is a tad unclear for me as to how it will actually function and on what types of audio etc?

My main interest in this, is due to the fact that I have a VSX-921 (EU model) which cost apx £500 and has DRC for DTS/AC3 and HD Codecs etc .. However some movies has NO DRC information available and therefore it makes no difference when enabled. This may help to solve this issue if it does indeed add DRC to all content including DTS tracks etc.

Thanks in advance...
find quote
htpc guy Offline
Posting Freak
Posts: 1,182
Joined: Oct 2010
Reputation: 7
Location: Near St. Louis Mo
Post: #2
I'm hoping we can get a good response on this. I'm very interested in finding out as well.

How to use Git
| AMD Athlon II X3 Triple Core Processor 2.9 GHz |GIGABYTE GA-MA785GM-US2H Mobo 2GB DDR2 Ram | MSI N430GT |
| Logitec Harmony One Remote| 52" Sharp Aquos LED TV | Demon AVR-X1000 |
find quote
bobo1on1 Offline
cheapass Team-XBMC Developer
Posts: 2,758
Joined: Dec 2008
Reputation: 22
Post: #3
It's explained in the commit message, that's all it does.
find quote
Ned Scott Offline
Team-Kodi Wiki Guy
Posts: 20,899
Joined: Jan 2011
Reputation: 274
Location: Arizona, USA
Post: #4
Built-in compressor?! Kick ass!
find quote
htpc guy Offline
Posting Freak
Posts: 1,182
Joined: Oct 2010
Reputation: 7
Location: Near St. Louis Mo
Post: #5
Is this in the nightly builds? How do you set up the advancedsettings.xml? Would love to test this.

How to use Git
| AMD Athlon II X3 Triple Core Processor 2.9 GHz |GIGABYTE GA-MA785GM-US2H Mobo 2GB DDR2 Ram | MSI N430GT |
| Logitec Harmony One Remote| 52" Sharp Aquos LED TV | Demon AVR-X1000 |
find quote
bobo1on1 Offline
cheapass Team-XBMC Developer
Posts: 2,758
Joined: Dec 2008
Reputation: 22
Post: #6
You can configure the limiter hold and release times like this:
Code:
<audio>
    <limiterhold>0.025</limiterhold>
    <limiterrelease>0.1</limiterrelease>
  </audio>
Those are the default values, you can use the limiter without adding anything to advancedsettings.xml, just increase volume amplification during playback.
The amount of volume attenuation is shown in the codec info, it's the att value.
find quote
PatrickBateman Offline
Posting Freak
Posts: 1,676
Joined: Mar 2011
Reputation: 17
Location: Another Earth
Post: #7
Hi bobo,

Thanks for the reply, I've been in and read the commits, however (and this could be down to me being a dumbass) I'm still a tad unclear on how this will function in the real world (for me at least).

I undertstand you've mentioned in the commits that it may not even compile on windows yet, so that will need to be tested first etc so please don't think I'm rushing you or anything...

However, would you be able to confirm, that in essence, this mean, that if I play a DTS 5.1 encoded mkv etc with my audio settings set to DTS/AC3 capable receiver, that this will indeed, allow me to enable a variable "DRC" that will either raise the volume of the quiet parts of the movie (while leaving the louder parts exactly where they are) and/or vica versa?

Therefore, presumably, reducing the large dynamic range that is currently present in some of my movies, when transistioning been explosions and voices etc ...

Also will it be lossy or lossless?

Or is this slightly different from what I Think it is?

As I mentioned earlier, if so that's an Incredible feature, as I currently own a 2011 model £500 Pioneer AVR (VSX-921 EU Edition) That 2011 model AVR doesn't even have a DRC mode that works on all movies.

It has a DRC mode, however it only works for some movies that contain an audio track that includes DRC flags..

As not all my movies have DRC flags, my DRC on my amp is rendered pretty much useless!

As i own the UK version, it also does not have the "Midnight Mode" that is available on the sister "US" version of the AVR.

Also Pioneers ALC is designed to limit the difference in varying tracks (song 1.mp3 / song 2.mp3/ Tv adverts etc and the difference between Movie1.avi and movie2.avi) and not the difference in the tracks contained within a DTS bit stream.

Therefore my £500 "award winning" Rolleyes AVR can't be used at night as it blasts the house down, so currently I am religated to using my TV speakers as they are much quieter...

If this does what I think it does, then you may have stop me from hunting you down and giving you a big wet kiss Wink as this is a HUGE deal for me, as currently, watching movies at night is a complete shambles.

After spending over £1200 on an AVR and 7.1 speakers etc i thought that in the year 2011 a "night mode" would come as standard on even the most basic of models, let alone a decent spec!

Yet, after £1200 total spend, i dont even have the ability to switch to night mode when watching movies in the evening?

Thanks again for the reply and the work you did on coding this into xbmc.

Pat~
(This post was last modified: 2011-09-28 02:31 by PatrickBateman.)
find quote
spiff Offline
Retired Developer
Posts: 12,386
Joined: Nov 2003
Post: #8
night mode (and such raping of the sound) is something you find on the very low end. they have nothing else going for them...
find quote
PatrickBateman Offline
Posting Freak
Posts: 1,676
Joined: Mar 2011
Reputation: 17
Location: Another Earth
Post: #9
Hey spiff,

It must be the exact opposite with pioneer as the elite range and the higher end 2021 in the VSX range all have midnight mode, where as the 1021 etc don't No frustrating to say the least.

I agree that it's a distortion of thr sound, however I have kids and live in an apartment and therefore on an evening (12am-2am) I can't really watch films as the voices are so quiet and gun shots etc are so loud.

Enabling DRC does not resolve this as pioneers DRC works on a flag related encoded system meaning they require the flags to be present to controll the range. As not all movies carry the flags, it means I can't watch a film quietly at night as it just blasts the house down.

For odd occasions like that, or when a new born is asleep next to you in it's Moses basket, I think a night mode is a useful helpful tool, meaning you can still watch the movie and not wake the baby etc..

Headphones are an option but I find I then don't hear all the sounds around me such as baby crying from other room or knocks at the door etc..

while I agree DRC etc damage the enjoyment of the sound somewhat, I think they are very useful and considerate on some occasions.

I think 20mph speed limits damage my enjoyment of driving at times, but I appreciate them outside of my child's nursery Wink

I may return my amp for the 2021 (which is twice the price) as it carries the "night mode" feature but it seems insane to pay almost twice the price (thousands of pounds) for a feature I thought would be standard in this day and age? I find it strange that all AVRs don't at least have the option?

Or if this new limiter does exactly what I need, then I'm very impressed as it will save me fro. Doing so.

However, I'm still a tad unclear on what it actually does? Can anyone explain it at all?
(This post was last modified: 2011-09-28 14:43 by PatrickBateman.)
find quote
spiff Offline
Retired Developer
Posts: 12,386
Joined: Nov 2003
Post: #10
i'll try. in extremely simplified terms.

we have a fixed range [0..20]. where 0 is silence and 20 is max amplitude.
now we have a signal

Code:
10 5 2 2

we want to amplify this by 300% (yes, overkill, just to illustrate). that is multiply the signal by 3. you get
Code:
30 15 6 6

the 30 is outside our data range, so it has to be clipped; the signal becomes
Code:
20 15 6 6

thus the name range compression - the LOUD stuff with a large amplitude is compressed, and is relatively less loud compared to the silent stuff.

dynamic range compression is a "smarter" version of this.
find quote
PatrickBateman Offline
Posting Freak
Posts: 1,676
Joined: Mar 2011
Reputation: 17
Location: Another Earth
Post: #11
Hey spiff,

Ahh, ok I see thank you for that... So will this work with a bitstream DTS track or (when audio options in xbmc are set to "AC3/DTS CAPABLE AMP") or does it require xbmc to decode the DTS audio first, the make the changes to the audio, and then pass to this to the amp as PCM or such?

Also, you mentioned it's "clipping the audio" is it actually clipping the audio or is it reducing the overall audio volume for that channel back down to the maximum limit which was (in this case) 20.

As long at it's works I'm extremely happy, I will probably use this every day as I am up late the the baby and if I watch a movie such as inception etc I usually wake the house up when the gun shots etc make an appearance. It frustrates my that after sending £1200 on decent kit I dont have a night mode available to me Shocked

If xbmc can remove that issue for me in any way, then I for one am eternally grateful as it will save me replacing my amp, spending twice the initial price all for the ability to watch 1 or 2 movies a day in a "night mode"

Maybe one day we will live in a world where DRC is an open standard and night mode for all is a reality... Laugh i find it nuts that DRC is not a standard on all movies/AVRs and blurry players etc ?. They must know that not everyone can withstand a 40db range change between voices and massive explosions... What about folks that work nights and come home at 4am etc and wanna watch the latest blockbuster... How on earth have the markets not come together and created a standard way of watching a movie at night?

It's not lime it's an u requested feature, when I searched my issue with my AVR there were thousands of posts by most pioneer/Denon/Onkyo/Yamaha customers asking the same thing? It should be a standard IMO.

But thats nit your problem Laugh so I'll stop ranting now, and I appreciate the explanation and the hard work that has gone Into creating this feature, I for one am very grateful Nod
find quote
spiff Offline
Retired Developer
Posts: 12,386
Joined: Nov 2003
Post: #12
it's decreasing the volume (strictly speaking it's amplifying the low signals more than the high signals) - clipping is the stupid way to go about it - just tried to illustrate the problem.

it only works on PCM.
(This post was last modified: 2011-09-28 15:24 by spiff.)
find quote
PatrickBateman Offline
Posting Freak
Posts: 1,676
Joined: Mar 2011
Reputation: 17
Location: Another Earth
Post: #13
Wonderful,

Sincerely appreciate that explanation. That is much clearer to me and I now think i understand how this will work much clearer.

So to my understanding,

Let's say my audio settings are as follows:

AC3 Capable Receiver [*]
DTS Capable Reciever [*]
Volume Limiter [ ]
My movies will bitstream as normal....

However, if I then:

AC3 Capable Receiver [*]
DTS Capable Reciever [*]
Volume Limiter [*]

Enable "Volume Limiter" it should decode my "5.1 DTS" to "6ch PCM" and then make the adjustments to the audio prior to sending them to my AVR.

My AVR can then play them using one of it's many modes for 6th PCM audio with the new volume levels attached.

Is this basically correct or close enough for me to stop annoying you Laugh
find quote
spiff Offline
Retired Developer
Posts: 12,386
Joined: Nov 2003
Post: #14
spot on. except i'm not sure if bobo added the logic to disable passthrough if you slide the limiter, but if he didn't, we should.
find quote
bobo1on1 Offline
cheapass Team-XBMC Developer
Posts: 2,758
Joined: Dec 2008
Reputation: 22
Post: #15
It doesn't work with passthrough, if you want the limiter, disable it.

Regarding how the limiter works, it's the "Limiter with zero attack and moderate release" in this image from wikipedia:
[Image: 800pxclippingcomparedto.png]
find quote
Post Reply