Page 1 of 3

Intersample peaks

Posted: Sat Jul 12, 2014 12:16 pm
by Drnkhobo
Hey guys, does anyone know how to implement an intersample peak meter?

I've tried some searching and nothing comes up on actual design. So I was wondering if anyone here had experience on this? Is it possible with FS?

My thoughts would be to do some math magic (up sample, interpolate liberally) ??

Any help would be appreciated :D

Re: Intersample peaks

Posted: Sat Jul 12, 2014 1:16 pm
by Tronic
generic info from here http://www.soundonsound.com/sos/feb14/a ... ss-war.htm
<< To detect inter-sample peaks a True Peak meter employs a relatively high oversampling ratio which allows it to more fully reconstruct the continuous audio waveform. BS.1770 calls for a minimum oversampling ratio of 4x, which gives a maximum possible under-read error of slightly less than 0.7dB. For that reason, the EBU recommends setting the permitted maximum level (PML) to -1dBTP, thus guaranteeing that the signal can never cause an overload or clipping in any following digital processing equipment or converters. (The ATSC A/85 recommendation sets a slightly more conservative PML of -2dBTP.)
Not surprisingly, the higher the oversampling ratio, the smaller the possible inter-sample under-read. An 8x oversampling ratio gives a maximum error of slightly less than 0.2dB, and 16x oversampling is accurate to within 0.05dB. However, higher oversampling ratios involve a greater processing overhead, and in practical terms the benefit is negligible in most cases. So the BS.1770 recommendation is for a PML of -1dBTP based on the more manageable 4x ratio, which is a very pragmatic solution adopted by the vast majority of loudness meter plug-in manufacturers. >>

Re: Intersample peaks

Posted: Sat Jul 12, 2014 1:35 pm
by trogluddite
I've seen 4x upsampling followed by peak estimation (termite interpolation seems popular) recommended in a few places - to meet the same standards that Tronic mentions.

Both are definitely possible with FS.
There was an oversampling toolkit available over on the SynthMaker forum - that should load OK to FS if it's still available. And I recall that martinvicanec did some good work on peak estimation for his pitch detector projects over at the SM site too. Martin hangs about here still, so he might be able to point you at the right parts of the code to extract.

Re: Intersample peaks

Posted: Sat Jul 12, 2014 1:52 pm
by Tronic

Re: Intersample peaks

Posted: Sat Jul 12, 2014 2:29 pm
by Drnkhobo
:lol: OOOH thanks guys!

I thought it would be done with oversampling. I will check these links out now & get back, much appreciated

Re: Intersample peaks

Posted: Sat Jul 12, 2014 3:13 pm
by Drnkhobo
loudness (LK) is then calculated:

LK = −0.691+10log10 ∑Gi ⋅zi

where Gi are the weighting coefficients for each channel.


What does that ∑ mean?

Re: Intersample peaks

Posted: Sat Jul 12, 2014 4:13 pm
by tester
On my computer looks like sigma (sum all).

Re: Intersample peaks

Posted: Sun Jul 13, 2014 12:06 pm
by martinvicanek
trogluddite wrote:There was an oversampling toolkit available over on the SynthMaker forum - that should load OK to FS if it's still available.
IIRC the oversampling kit uses IIR filters which are not linear phase. That may distort the peaks. Not sure how severe that would be but I'd recommend a linear phase FIR. Perhaps a 4-point Lagrange interpolator would suffice?
trogluddite wrote: And I recall that martinvicanec did some good work on peak estimation for his pitch detector projects over at the SM site too.
Hmm, you mean the spectral peak estimation. Yes, that could probably also be used in the time domain, why not? Basically you look at the maximum (or minimum) sample and its two neighbors. Should be pretty lightweight on CPU compared to oversampling.

Edit: first analysis shows that neither 4-point Lagrange upsampling nor the neighbor-based peak estimation are particularly accurate in this context.

Re: Intersample peaks

Posted: Sun Jul 13, 2014 4:10 pm
by tulamide
Since the experienced users are all gathered, may I ask a question?

I know what intersample peaks are. Are they in any way harming? Since there are no intersample-samples in the digital domain, wouldn't they just be non-existant when the sound is outputted to the analog domain? Or will there still be some kind of curve between two samples, maybe due to the analog hardware?

Re: Intersample peaks

Posted: Sun Jul 13, 2014 5:02 pm
by Tronic
tulamide wrote:Since the experienced users are all gathered, may I ask a question?

I know what inter-sample peaks are. Are they in any way harming? Since there are no intersample-samples in the digital domain, wouldn't they just be non-existant when the sound is outputted to the analog domain? Or will there still be some kind of curve between two samples, maybe due to the analog hardware?

The ISP meter, measure the level above allowed by your D/A converter, and with an approximation to reconstruct the waveform at the points that exceeded 0dBFS, and measuring them, so to give a pseudo-value for recalibrate your level of output.