Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Advanced Limiter (Read 14443 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: Advanced Limiter

Reply #25
You are wrong.  PCM is based on sampling and sampling requires bandlimiting...  Besides, as I said, any practical filter still has a range bigger than a few samples.  I'm out of here.  I was tired of listening to naiveté about sampling systems after two days in school > 40 years ago.

Re: Advanced Limiter

Reply #26
See my previous post - if two contiguous sample are at the max and that doesn't represent overflow then the source signal must have been flat between them.
I thought that the thread is not about intersampling overs?

Re: Advanced Limiter

Reply #27
I was responding to the arguments that a square wave is an example of a legitimate PCM signal with two contiguous maximum value samples.  Re "intersampling overs": as I see it you can either assume PCM means no restrictions on any bits any time or you take into account sampling theory and have to deal with bandlimited signals.  Only one of these seems to be practical for a real DAC - it needs to operate on real signals...  It would have been nice if Redbook defined minimally acceptable filters.  "intersampling overs" aren't avoidable with bandlimited signals.

Re: Advanced Limiter

Reply #28
That sounds like you use the limiter for converting audio files, not just for music playback.
Wouldn't it be a better solution to remove the advanced limiter from converter DSP chain?
foobar2000 has a seperate DSP setup for the converter.
If you don't want any change of your files remove all DSP from converter setup.
Where is the point using a DSP if you don't need it?

How do you always know exactly when you will and won't need it?
Yes, I use it for both audio playback and sometimes for converting files. If possible I'd try to ensure the volume isn't high enough to require the use of the limiter, but I don't see how that makes it okay for it to adjust the volume if it's  not limiting.

Downmixing 6.1ch to 5.1ch I use the matrix mixer to add the rear centre channel to the 5.1ch surround channels, then follow that with the advanced limiter in case it causes those channels to clip. I could use a normalised downmix matrix instead but that'd reduce the volume of all the channels, usually unnecessarily, and then I'd have to peak normalise. I downmix 7.1ch to 5.1ch in a similar way.

My mother teaches line-dancing in a hall with a small portable PA so when I put the music on her tablet for her I have to squeeze every last ounce of volume out of it. I use ReplayGain to adjust all the music to 93dB. The extra 4dB makes all the difference, but it increases the likelihood of clipping, so I always put the advanced limiter in the conversion chain. Otherwise I've got to scan every file for peaks above 0dB and convert them again with the limiter in the chain anyway.

Lots of reasons to have it in the conversion chain in case limiting is required....

Re: Advanced Limiter

Reply #29
The original recommendation for mastering audio CD was that the PCM values should not reach limits at any time.

I don't know if you've ripped any CDs and scanned them recently but it's not unusual to have peaks above 0dB, especially during the height of the loudness wars, so they were obviously peak normalised with the samples at a maximum of 0dB.

Re: Advanced Limiter

Reply #30
The maximum ReplayGain peak level for integer PCM is 1.0.  ReplayGain doesn't reconstruct a virtual waveform; it simply notes the maximum sample magnitude.

Re: Advanced Limiter

Reply #31
Please disregard my previous post.  I misinterpreted what you meant.

Re: Advanced Limiter

Reply #32
Not all DACs have headroom to take intersample peaks into account. When I tested various sound cards I have in my possession they all clipped sooner or later. I don't believe there is any actual music where this would cause problems but if you want to be sure you would need to configure a high samplerate resampling before the Advanced Limiter DSP.

Re: Advanced Limiter

Reply #33
The maximum ReplayGain peak level for integer PCM is 1.0.  ReplayGain doesn't reconstruct a virtual waveform; it simply notes the maximum sample magnitude.
Please disregard my previous post.  I misinterpreted what you meant.

I'm not sure whether you're saying the ReplayGain peak is a maximum of 1.0 though, because it can be higher, can't it?

Whether it's according to spec or not, it's not unusual to have peaks greater than 1.0 after scanning with foobar2000, and there is that oversampling setting in preferences. It definitely makes a difference to the peak result.

Re: Advanced Limiter

Reply #34
http://wiki.hydrogenaud.io/index.php?title=ReplayGain_specification#Peak_amplitude

Yes, the ReplayGain peak can be greater than 1.0.  Integer sample formats will never result in a peak value greater than 1.0 because their full-scale is 1.0 by definition, unless:

The ReplayGain scanner in foobar2000 has an implementation-specific "Peak scan oversample factor" option, which allows non-standard behavior.  You might use it to preempt soft (analog) clipping in your DAC, without having to manually adjust foobar2000's preamp value as I suggested earlier.  The only way it would objectively work is if you chose an oversample factor that perfectly matched your DAC's internal oversampling factor and used the exact same filter while still resulting in a compatible input sample rate for your DAC.  In other words, extremely unlikely.  Plus, the factor must be an integer.  Also, the resampling requires CPU, and good luck perfectly (as defined by ReplayGain) matching the volume level of audio scanned by other ReplayGain scanners.

I think "Peak scan oversample factor" is a pointless feature.  ReplayGain's peak value is intended to prevent hard (digital) clipping only.  The solution I described (manually adjusting preamp when peaks cross 0 dBFS) is much simpler and puts the user in control.  The second half of my solution (buying a DAC that satisfies your arbitrary oversampling [read: qualitative] requirements) gives the user even further control, as nature intended.

Re: Advanced Limiter

Reply #35
I think "Peak scan oversample factor" is a pointless feature.
Just because you don't use a feature doesn't make it pointless.  It works perfectly for me and my DAC (which doesn't do soft clipping, it just doesn't clip at all when upsampling.)  I simply do my scans with a peak oversampling of 32 or whatever for the best accuracy.

Re: Advanced Limiter

Reply #36
I think "Peak scan oversample factor" is a pointless feature.

Fine, I'll say it without the "I think," just watch: "Peak scan oversample factor" is a pointless feature.

And it remains an opinion!  Yup, still an opinion, folks.  Even when I omit the words "I think,"  it's still an opinion because the statement in question is subjective subject matter.  Subject.

Actually, if you want to get technical, I could argue that my statement is a fact because "Peak scan oversample factor" is an arbitrary value, so in terms of a perfect application of ReplayGain, using it (changing from the default value "1," which means no effect) is incorrect.  Good thing doing so is optional.

This is what forums are all about, though.  Arguing pointlessly until blue in the face.  Wouldn't want someone in the wide world to misconstrue my "I think" statement as fact, now, would we.

best accuracy
Would technically be no oversampling.  Why not 33?   40?  (You seem to like that number of years... if only it inherently meant something.)  Insert your favorite number here?  And welcome back. :)

Re: Advanced Limiter

Reply #37
The true peak scanner works properly regardless of your DACs or its filters. Once sample rate is high enough you have enough points from the constructed waveform to know the highest peak you will reach with non-broken implementations. IIRC EBU quotes 192 kHz to be the more than sufficient. There are of course slight differences in sample values with difference resamplers but we all know good resamples are audibly indistinquishable to the human ear.

Re: Advanced Limiter

Reply #38
Still trying to get my head around this oversampling thing..... because I probably don't know what I'm talking about.....

My understanding is there's no "true peak" in the ReplayGain spec, but does that make knowing the "true peak" a bad thing?

A fair while ago I played around with the R128Gain program, which appears to have been abandoned. I understand the tags it writes aren't spec compliant (although I thought they were a good idea myself) but it does have a "true peak" scanning option which I assumed was required for EBU 128 scanning, so I did some testing at the time compared to foobar2000's overscanning option and I"m pretty sure a resampling value of 4 produced the same result as the R128Gain's "true peak" so I've been using an overscanning value of 4 with foobar2000 ever since. Was I on the wrong track there?

Obviously the overscanning value makes quite a difference to the scanning time. I'd forgotten how much till just now when I checked it. For a 50min stereo AAC file I (just happened to be downmixing 5.1ch audio from a TV show at the moment), it took four seconds to scan with an oversampling value of one, about a minute with an overscampling value of four, and I tried an oversampling value of thirty two (given tedsmith mentioned it earlier), but I'll confess my enthusiasm wouldn't extent that far as it increased the scanning time to about seven minutes.

For one file I tested, an oversampling value of one produced the same result as four, for the second it was 1.019293 vs 1.02121, which is so minor if that's all it ever was I wouldn't care, but if memory serves me correctly sometimes the difference can be a dB or more.

Anyway, I'm just trying to understand why obtaining a more accurate "true peak" is a bad thing or unnecessary as I don't think I've got my head around that yet.

Cheers.

Re: Advanced Limiter

Reply #39
Oversampling to find a "true peak" (does such a thing actually exist; "true" is relative to the reconstruction filter) is "bad" because it's an attempt to solve an analog problem in the digital domain, and no perfect solution exists.  It's unnecessary because simpler steps save CPU by only requiring gain reduction.

Oh yeah, and Advanced Limiter.

Re: Advanced Limiter

Reply #40
Here's a screenshot of a 16-bit PCM audio file from a piece of real music:

The top and bottom of the sample view are maximum sample values 16-bit PCM can hold and the little dots are samples. The lines show the true waveform that clearly extends beyond the digital range. Advanced Limiter doesn't do anything to this signal and your DAC will happily attempt to play it as is.
Benchmark DAC2, a $2000 DAC, has 3.5 dB digital headroom in attempt to handle such files but even that isn't enough for this sample. Normal consumer soundcards have no headroom. ReplayGain scanner with 4x oversampling reveals the peaks to be 5.09 dB above digital fullscale. The AAC version of this track has its peaks over 6 dB above fullscale.
I don't make any claims about audibility of the clipping with music but I know it's easily audible with test files. With test files where the clipping can be heard lowering the amplitude to take true peaks into account makes them play without glitching. This proves that true peak scanning is a working method.

Re: Advanced Limiter

Reply #41
In A/B'ing some level matched CD players years ago we were confused between two players where one was clearly more dynamic and appeared to be louder with pop music.  It turned out that the other was a brand that had hardly any headroom in it's oversampling.  This isn't just a theoretical discussion.  The references in this thread mention also mention tests that reveal the brand I'm talking about.

Re: Advanced Limiter

Reply #42
Oversampling to find a "true peak" (does such a thing actually exist; "true" is relative to the reconstruction filter) is "bad" because it's an attempt to solve an analog problem in the digital domain, and no perfect solution exists.  It's unnecessary because simpler steps save CPU by only requiring gain reduction.

That's the part where I guess I'm still being dumb. The method of obtaining the "true peak" aside..... how do you know how much to reduce the gain without knowing what the "true peak" is?

The problem I'd have with using the Advanced Limiter all the time is there's no way to know if it's actually limiting unless you first scan the source files or scan the output files. Admittedly sometimes it doesn't matter. When I put music on my mother's tablet I make it all 93dB (in ReplayGain speak) and reducing the volume to prevent clipping isn't an option due to it all having to be the same volume, so the Advanced Limiter is always in the conversion chain.
For some other stuff though.... I'd like to know what the peaks are before I decide to reduce the volume or squash them with the Advanced Limiter.....

I'm sure I've come across examples similar to the one Case posted. Not necessarily having more than a single peak above 0dB though, but a peak the Advanced Limiter didn't seem to touch. I guess I'm beginning to understand why. For some files I've had to use the -6dB Hard Limiter instead, and on the odd occasion to prevent the "true peak" from being much greater than 0dB, I've had to use both limiters, at least when encoding as AAC.

Now I'm starting to understand how things work a little more... is there a reason why the Advanced Limiter shouldn't kick in a little earlier (-3dB as an example)? Or would there be a reason not to make the threshold adjustable? I've effectively adjusted it before when I know the peaks are at 0dB or above, by first boosting the volume by 3dB (using the ReplayGain function in the conversion chain), applying the Advanced Limiter, then following it with another DSP to simply reduce the volume by 3dB again, but it'd be easier if it the Advanced Limiter itself was adjustable. Speaking of which, is anyone aware of a DSP that does nothing but adjust the volume? It'd be handy sometimes.

Cheers.

Re: Advanced Limiter

Reply #43
dumb
Such a strong word. :(

The problem I'd have with using the Advanced Limiter all the time is there's no way to know if it's actually limiting unless you first scan the source files or scan the output files.
Yes, no way to know ahead of time (ignoring arbitrary oversampling).  That's why I monitor the Peak Meter Visualization to make sure that I have enough Preamp reduction without being "too much" (also arbitrary, but at least there is more direct control), combined with listening for analog clipping artifacts (hasn't been audible).

Speaking of the Peak Meter, I've noticed it extends a couple pixels beyond 0 dB with no DSPs/resampling in the chain playing normal CD FLAC files.  Bug?

Re: Advanced Limiter

Reply #44
Speaking of the Peak Meter, I've noticed it extends a couple pixels beyond 0 dB with no DSPs/resampling in the chain playing normal CD FLAC files.  Bug?

I tried, but without any DSPs in the playback chain I couldn't get it to budge above 0dB, even when I deliberately converted an MP3 to flac while increasing the volume enough for it to clip pretty hard.
Is there an option to make the peak meters oversample? :) (that was actually a serious question, now I think about it)
Could it be a high resolution/DPI problem? I'm still running foobar2000 on XP on a CRT monitor.



While I was at it, I scanned the flac file in question, just to see.....
Oversampling 1x, 4x & 32x


Re: Advanced Limiter

Reply #45
False alarm.  I had forgotten about the Equalizer with a reduction in the 77 Hz band that I recently added to the DSP chain.  Sorry about that.

Well, some nice proof that equalizer's aren't perfect, either! :)

Re: Advanced Limiter

Reply #46
How do you always know exactly when you will and won't need it?
If you want lossless conversion then don't use any DSP, just to be sure the PCM stay bit-identical.

Use DSP only for playback if that matters to you. DSP are for processing files. Processing means change.

Does using DSP for files that are in a lossy format matter at all?

Lots of reasons to have it in the conversion chain in case limiting is required....
But you can't have both. Lossless conversion and limiting. You have to decide for one way or the other.

Re: Advanced Limiter

Reply #47
How do you always know exactly when you will and won't need it?
If you want lossless conversion then don't use any DSP, just to be sure the PCM stay bit-identical.

Where was lossless conversion a requirement?

Use DSP only for playback if that matters to you. DSP are for processing files. Processing means change.

Did you not read any of the post you're replying to?

Does using DSP for files that are in a lossy format matter at all?

Why wouldn't it? Which DSP are you referring to? If it's the Advanced Limiter what difference does it make if the format you're converting to is lossless or lossy?

Lots of reasons to have it in the conversion chain in case limiting is required....
But you can't have both. Lossless conversion and limiting. You have to decide for one way or the other.

It seems fairly self-explanatory that using a DSP to alter the audio when converting wouldn't be lossless, but I still don't know where the lossless requirement comes from.

Re: Advanced Limiter

Reply #48
Sorry. Ignore my post. I missunderstand your intentions.

Re: Advanced Limiter

Reply #49
Speaking of the Peak Meter, I've noticed it extends a couple pixels beyond 0 dB with no DSPs/resampling in the chain playing normal CD FLAC files.  Bug?

I tried, but without any DSPs in the playback chain I couldn't get it to budge above 0dB, even when I deliberately converted an MP3 to flac while increasing the volume enough for it to clip pretty hard.
Is there an option to make the peak meters oversample? :) (that was actually a serious question, now I think about it)
Could it be a high resolution/DPI problem? I'm still running foobar2000 on XP on a CRT monitor.



While I was at it, I scanned the flac file in question, just to see.....
Oversampling 1x, 4x & 32x



From my experiment any lossless format, be it wav, FLAC, ape, etc. will just save any values beyond 1 as 1 (0dB). So even if you add 20dB gain to a song during the conversion to FLAC, the result will still has the peak of 0dB or 1.00 at the end.

AAC on the other hand, can store arbitrary numbers such as 1.4 or even higher.

I'm not saying it's "correct" or not, just what I observed. Give it a try.