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: replaygain, intersample overs, and reconstruction stages (Read 17505 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

replaygain, intersample overs, and reconstruction stages

My understanding of intersample overs is that they are waveform peaks occuring between samples, that aren't reconstructed to their 'true' amplitude  by consumer gear because the samples on either side of the peak are too close to 0dBFS already.  These intersample peaks can be as much as 6dB 'over' 0dBFS, or more commonly a few dB over.  They 'happen' when a production is monitored using peak meters that only measure peak values of the samples, rather than the levels of the reconstructed waveforms.  So if an engineer slams the sample peaks repeatedly up to near 0dB, as part of the loudness wars, the file will still show as 'legal' using the inadequate meter. It will be 'illegal' in terms of the level of the true  waveform peak levels.  Consumer gear and consumer software D/A stages don't 'know how' to reconstruct peaks that are >0dBFS, outputting distortion instead.

Assuming I've got this right (tell me if not), does lowering sample peak level a few dB in the digital domain -- e.g. by applying negative replaygain values -- prior to D/A reconstruction increase our chance of recovering the 'true' waveform at output? Or is that accurate peak shape lost forever?

Another way to phrase this is, how do consumer D/A stages normally reconstruct peaks that occur between samples, and why can't they do it when such peaks are over 0dBFS?

replaygain, intersample overs, and reconstruction stages

Reply #1
Assuming I've got this right (tell me if not), does lowering sample peak level a few dB in the digital domain -- e.g. by applying negative replaygain values -- prior to D/A reconstruction increase our chance of recovering the 'true' waveform at output?
Yes, absolutely.

Sorry I can't answer your last question with any true authority, but many others here certainly can.

replaygain, intersample overs, and reconstruction stages

Reply #2
TC Electronic has some very good papers on various aspects of +0 intersample peak metering and reproduction in their tech library (scroll down to the "Mastering and Formats" section).
"Not sure what the question is, but the answer is probably no."

replaygain, intersample overs, and reconstruction stages

Reply #3
Another way to phrase this is, how do consumer D/A stages normally reconstruct peaks that occur between samples, and why can't they do it when such peaks are over 0dBFS?
Before the "discovery" of intersample overs DAC manufacturers didn't expect the signal peaks to exceed 0 dBFS and designed the (reconstruction) filter and the following analog  stages to be able to handle just that level. This isn't as careless as it might seem nowadays: the output of an AD converter is very unlikely to contain iso's. Digital (post-)processing however enables signal manipulations that can easily create those overs, especially with dynamic (over)compression.
You're right that the consumer can easily solve the problem by reducing the signal level just before the DAC.
The biggest risk for iso's is during recording/mixing/mastering. The signal passes through many processes, each of which can introduce iso artifacts. Once a distorted signal passes an EQ or a reverb e.g., you might never be able to get rid of it afterwards. TC Electronic did an excellent job in making the audio professionals aware of the problem and suggesting solutions (use good peak-meters and keep the levels away from 0 dBFS).

Kees de Visser

replaygain, intersample overs, and reconstruction stages

Reply #4
These intersample peaks can be as much as 6dB 'over' 0dBFS

Oh really? I thought the maximum is 3dB.

Cheers!
SG

replaygain, intersample overs, and reconstruction stages

Reply #5
Check the papers by Aldrich and  by Lund.  6dB is the cited maximum, though it's under extraordinary conditions.

 

replaygain, intersample overs, and reconstruction stages

Reply #6
Oh, it's even worse! Theoretically, you can't guarantee such a limit unless the reconstruction filter's impulse response has a finite extent.

For example: Using sinc interpolation on the signal

[ ... 1 -1 1 -1 1 1 -1 1 -1 1 ... ]  (Note: There's a pair of 1 in the middle next to each other)

results in the infinite sum
Code: [Select]
4/pi * \sum_{k=0}^{\infty} 1/(1+2k) == \infty

for the value right in the middle between the pair of +1s.

To be honest: That was unexpected.


However, using more practical reconstruction filters it'd be something like 2.5 (+8 dB) or less. Also, "normal music" isn't really a big problem due to the low energy in the above frequencies.


Cheers!
SG

replaygain, intersample overs, and reconstruction stages

Reply #7
My questions are ultimately about reconstruction.  How does pro gear accurately reconstruct the peaks above 0 dBFS? And do I achieve the same effect by bringing the level down with , say replaygain?  Or is the peak forever 'lost'?

I don't recall seeing 'new' curved peaks when I use Audition to look at the waveforms of loud tracks I've replaygained. Flat-topped peaks still look flat-topped.

replaygain, intersample overs, and reconstruction stages

Reply #8
And do I achieve the same effect by bringing the level down with , say replaygain?  Or is the peak forever 'lost'?
Again, the answer to this part of your question is NO.


replaygain, intersample overs, and reconstruction stages

Reply #10
If you reduce the level of the data before it hits the DAC then it should be able to reproduce what was previously an ISO without clipping.  The peak is not "forever lost".

replaygain, intersample overs, and reconstruction stages

Reply #11
I don't know what "pro gear" does to "reconstruct" the wave. However, I do know that  the true intersample data is LOST!  For all we know, there may have been an intersample dip rather than an intersample peak!  (We do know that there is not a complex waveform between samples, because the signal has been low-pass filtered as required by Nyquist.)

A low-pass filter will often have a slight peak (1 to 3dB) just-before the cutoff frequency.  The low-pass filter following the DAC could "reconstruct" a high-frequency peak greater than 0dBFS.  However, the filter and following analog circuitry will generally have some headroom above 0dB, so this should not contrubute to clipping.  (If the analog section is causing clipping, then digitally reducing the gain will help.)

Quote
I don't recall seeing 'new' curved peaks when I use Audition to look at the waveforms of loud tracks I've replaygained. Flat-topped peaks still look flat-topped.
  When you "look" at the waveforms, you are looking at the digitized samples.  So, there is no intersample data (or intersample reconstruction).  You would have to observe the analog output with an oscilloscope to see these effects.  And, ReplayGain does not change the shape of the wave.  In fact, it doesn't change audio data at all!  It simply changes the gain applied during playback.

replaygain, intersample overs, and reconstruction stages

Reply #12
I don't know what "pro gear" does to "reconstruct" the wave. However, I do know that the true intersample data is lost!  For all we know, there may have been an intersample dip rather than an intersample peak!  (We do know that there is not a complex waveform between samples, because the signal has been low-pass filtered as required by Nyquist.)
This is not a theoretical discussion about digitization; we're talking about the practical reconstruction of digital signals.  Let's not quibble about the "true" nature of the original analog signal before it was sampled.  Intersample overs are a real phenomenon and can be prevented by attenuating the signal before reconstruction.

A low-pass filter will often have a slight peak just-before the cutoff frequency.  The low-pass filter following the DAC could "reconstruct" a high-frequency peak greater than 0dBFS.  However, the filter and following analog circuitry will generally have some headroom above 0dB, so this should not contrubute to clipping.
I thought you said that you don't know what pro gear does to reconstruct analog signals.

Quote
I don't recall seeing 'new' curved peaks when I use Audition to look at the waveforms of loud tracks I've replaygained.
When you "look" at the waveforms, you are looking at the digitized samples.  So, there is no intersample data (or intersample reconstruction).
Not so.  Audition fills in inter-sample data based on ideal reconstruction.

And, ReplayGain does not change the shape of the wave.
It doesn't have to.

It simply changes the gain applied during playback.
Which changes the audio data before it's sent to the DAC!

Assuming I've got this right (tell me if not), does lowering sample peak level a few dB in the digital domain -- e.g. by applying negative replaygain values -- prior to D/A reconstruction increase our chance of recovering the 'true' waveform at output?
Yes, it does.

replaygain, intersample overs, and reconstruction stages

Reply #13
I don't know what "pro gear" does to "reconstruct" the wave. However, I do know that the true intersample data is lost!  For all we know, there may have been an intersample dip rather than an intersample peak!  (We do know that there is not a complex waveform between samples, because the signal has been low-pass filtered as required by Nyquist.)


'Reconstruct' is not bizarre terminology -- digital gear uses reconstruction filters. And my refefnce to 'pro gear' being able to reconstruct the correct intersample amplitude between two samples near or at 0dBFS, is straight from the papers of Lund or Aldrich.

Quote
A low-pass filter will often have a slight peak just-before the cutoff frequency.  The low-pass filter following the DAC could "reconstruct" a high-frequency peak greater than 0dBFS.  However, the filter and following analog circuitry will generally have some headroom above 0dB, so this should not contrubute to clipping. 

Quote
I don't recall seeing 'new' curved peaks when I use Audition to look at the waveforms of loud tracks I've replaygained. Flat-topped peaks still look flat-topped.
  When you "look" at the waveforms, you are looking at the digitized samples. 


But in Audition at least, you aren't looking at a simple 'connect the samples with a straight line' representation. For example, a 44.1 kHz-sampled 15kHz sine wave in Audition definitely shows some peaks rising and falling between two samples.  That's the software doing a visual representation of predicted output (a 'reconstruction' if you will).  I was just curious how it knows to show that part of the curve a peak, rather than say, a flat line between the two samples, or even a dip.

My recollection was that flat intersample regions stayed flat when viewed after downward digital amplification (eg after applying replaygain values to the file to 'see' what it would look like). But no longer trusting my 'recollection', I just did this experiment myself in Audition -- first I normalized such a region of a 15 kHz sine wav (ripped from a home audio setup CD with test tones) so that peak sample value is  0dBFS.  Now the above-mentioned intersample 'peak' is flat. Saved the file.  Reopened it. Reduced level so samples peak at -3 dB instead.  Et voila, the original rounded intersample peak is back.  So I'm a believer that it can work.


Quote
So, there is no intersample data (or intersample reconstruction).  You would have to observe the analog output with an oscilloscope to see these effects.  And, ReplayGain does not change the shape of the wave.  In fact, it doesn't change audio data at all!  It simply changes the gain applied during playback.



I already knew what replaygain does and does not do in this regard, thanks.  I know the software itself merely calculates a digital amplification value, and that playback software merely applies this to output, not altering the actual file itself -- unless you tell it to (e.g. an option for foobar2000 file saving) in order to create a 'permanently' re-levelled version.

replaygain, intersample overs, and reconstruction stages

Reply #14
I normalized such a region of a 15 kHz sine wav (ripped from a home audio setup CD with test tones) so that peak sample value is  0dBFS.  Now the above-mentioned intersample 'peak' is flat. Saved the file.  Reopened it. Reduced level so samples peak at -3 dB instead.  Et voila, the original rounded intersample peak is back.  So I'm a believer.
So we're good here.

Now what's left is your question about consumer gear.  Did the documents at t.c. electronic linked by mixminus1 provide any information that you found helpful?

replaygain, intersample overs, and reconstruction stages

Reply #15
I normalized such a region of a 15 kHz sine wav (ripped from a home audio setup CD with test tones) so that peak sample value is  0dBFS.  Now the above-mentioned intersample 'peak' is flat. Saved the file.  Reopened it. Reduced level so samples peak at -3 dB instead.  Et voila, the original rounded intersample peak is back.  So I'm a believer.
So we're good here.


Well, I have minorly re-worded some of that since you replied.   

I wonder if my probe signal isn't quite the same as what I recall seeing in some hypercompressed CDs.  There, Audition actually draws a LINE between two samples at 0dB.  In my probe signal, when I normal two equal-value sample to 0dB, the intersample peak disappears, but Audition doesn't draw a line between them.
It's like the real peak is simply 'hiding offstage'.  In commercial discs, it seems the data are gone, and bringing the peak level down doesn't 'bring them out of hiding'.

But I need to find some commercial CD examples to verify this.  Lund et al do talk about multiple production stages at +0dBFS causing the peaks to be lost.


Quote
Now what's left is your question about consumer gear.  Did the documents at t.c. electronic linked by mixminus1 provide any information that you found helpful?


No, they seem to assume an understanding of reconstruction filters than I lack.  But I'm sure the info is out there. I just need to get off my lazy butt. I even have Pohlmann's book at home and bet he explains it all in there.


replaygain, intersample overs, and reconstruction stages

Reply #17
Interesting subject. My 2 cents:
I normalized such a region of a 15 kHz sine wav (ripped from a home audio setup CD with test tones) so that peak sample value is  0dBFS.  Now the above-mentioned intersample 'peak' is flat. Saved the file.  Reopened it. Reduced level so samples peak at -3 dB instead.  Et voila, the original rounded intersample peak is back.  So I'm a believer.

Audio editor must be able to "reconstruct" a picture of the signal to show to us these good-looking waveforms. If we zoom-in to the level where the screen has pixels without "assigned" samples program should interpolate the "missing" values. What interpolation function is in use - I don't mind - cubic will be enough to see these "intersample" peaks appearing again.

But I need to find some commercial CD examples to verify this.  Lund et al do talk about multiple production stages at +0dBFS causing the peaks to be lost.

I don't believe that occasional one or two "maxed" samples will lead us to any audible effect. I think even analog filter will "reproduce" the signal in similar way to Audition (it will remove higher freqs).

What I'd like to see if it's possible to "reconstruct" a dozen concurrent clipped samples (hello Paul with Memories Almost Full! Great recording  )

replaygain, intersample overs, and reconstruction stages

Reply #18
That's the sort of commercial CD example I'm referring to.

I'll post some Audition screen caps this weekend or next week.

replaygain, intersample overs, and reconstruction stages

Reply #19
1. Nyquist was right. In theory, a waveform of bandwidth <B can be sampled at a samplingrate of 2B and perfectly recreated using a brickwall reconstruction filter.  The fourier-transform of a brick is a sinc - lets pretend that this filter is all-analog and that there is no oversampling. In practice, there is no way of knowing the actual implemented reconstruction filter other than measuring it.

2. Nyquist did not (AFAIK) talk about quantisation and non-linear distortion - at least not in the famous theory bearing his name. The ideally reconstructed waveform may or may not exceed the limits presented by the max/min sample levels. If the reconstructed waveform exceeds the "reference" max/min levels, then the analog stage of the D/A-converter must have enough headroom to represent that level without clipping. I think this is primarily an "analog" problem, not a digital one.

3. Nothing fundamentally new has happened to the technology exposing this problem, but the use of compression/clipping/normalising in the mastering industry means that bad designs have a larger chance of giving users bad sound.

4. One simple solution is to digitally reduce the level prior to D/A.

5. Cool edit/Adobe Audition tries to hint at the reconstructed waveform by doing reconstruction filtering of the samples before a graphical representation is drawn. Take a look at the overshoots below:


-k

replaygain, intersample overs, and reconstruction stages

Reply #20
5. Cool edit/Adobe Audition tries to hint at the reconstructed waveform by doing reconstruction filtering of the samples before a graphical representation is drawn. Take a look at the overshoots below:


Your screen highlights Gibbs Phenomenon, which is a separate issue from intersample overs.  Overshoot will be seen at the ADC also and so it isn't much of a factor here.


replaygain, intersample overs, and reconstruction stages

Reply #22
Oh, it's even worse! Theoretically, you can't guarantee such a limit unless the reconstruction filter's impulse response has a finite extent.

For example: Using sinc interpolation on the signal

[ ... 1 -1 1 -1 1 1 -1 1 -1 1 ... ]  (Note: There's a pair of 1 in the middle next to each other)

results in the infinite sum
Code: [Select]
4/pi * \sum_{k=0}^{\infty} 1/(1+2k) == \infty

for the value right in the middle between the pair of +1s.

To be honest: That was unexpected.


However, using more practical reconstruction filters it'd be something like 2.5 (+8 dB) or less. Also, "normal music" isn't really a big problem due to the low energy in the above frequencies.


Cheers!
SG

I dont understand your formula. Is it mathematica or something? Do you speak matlab? :-)

A digital FIR filter should be scaled by the sum of the absolute value of every coefficient. I think that this assures that no digital overload occurs, even for a input vector of all 1s and -1s of the same polarity as the coefficients, being the worst case. Now, for a long filter this easily results in a large scaling-factor, and probably a smaller and smaller chance of the worst-case input ever occuring (especially in music as, as you say, 22049Hz 0dBFS sines arent that common in music).

Now, the analog side of the DAC should be able to cope with any instantaneous levels the reconstruction filter should ever try to produce. I am guessing that having a little guardband will decrease the chance of very high peaks "in-between samples"?

-k


5. Cool edit/Adobe Audition tries to hint at the reconstructed waveform by doing reconstruction filtering of the samples before a graphical representation is drawn. Take a look at the overshoots below:


Your screen highlights Gibbs Phenomenon, which is a separate issue from intersample overs.  Overshoot will be seen at the ADC also and so it isn't much of a factor here.

Is it?

Gibbs phenomenon is simply the result of lowpassfiltering an "edge". This results in "in-between-levels" that may exceed the values of any samples. If the waveform is normalised digitally, then the problem may manifest itself in the DAC?

I thought that this was exactly the same as "intersample overs", where lowpassfiltering a sequence of samples could produce analog levels exceeding that of any sample?

-k

replaygain, intersample overs, and reconstruction stages

Reply #23

4/pi * \sum_{k=0}^{\infty} 1/(1+2k) == \infty

I dont understand your formula. Is it mathematica or something? Do you speak matlab? :-)

It's pseudo-LaTeX. It describes the sum:
4/pi * ( 1 + 1/3 + 1/5 + 1/7 + ... )

You'll get there via  sinc(1/2 + k) = (-1)^k * 2/pi * 1/(1+2k)  for k=0,1,2,3,...


Cheers!
SG

replaygain, intersample overs, and reconstruction stages

Reply #24
Your screen highlights Gibbs Phenomenon, which is a separate issue from intersample overs.  Overshoot will be seen at the ADC also and so it isn't much of a factor here.

If Audition/Cool Edit 2000/CEP used anti-alias filtering when synthesizing waveforms you would see Gibbs Phenomenon and it would be reflected in the magnitude of the samples, but the program doesn't.  Try creating a 8kHz square wave in a new file with a 44.1kHz sample rate and this will become readily apparent; if there was no aliasing, the program would return a sine wave.

What you're seeing here may look like Gibbs Phenomenon, but it really isn't.