ΣSigmaStudio Ask AI Русский Log in

Envelope Peak

SigmaDSP & SigmaStudio Toino Jun 26, 2016 00:00 7 replies Original on forum ↗
Subscribe
Toino Question
Jun 26, 2016 00:00

Appreciate if somebody could explain the difference between “Envelope Peak” and “Envelope Peak Accurate”.

Thank you

envelope

DaveThib Reply
Jul 6, 2016 00:00

Hello Toino,

It pretty much is like the name says. "Peak Accurate" is measuring the peak values much more accurately but the trade off is processing time. It is more processor intensive. So we give you the choice based on your application. Some places you really require high accuracy but other places it is not important. Sometimes a smaller program size is the most important.

Dave T

ADIApproved Reply
Jul 6, 2016 00:00

Hi Toino:

I'll slightly add to Dave's response.

There was an inconsistency that happened when users utilized a tone with a frequency being an integer divider of the sample rate. Say FS/4. Using this sine tone (or any constantly repeating, periodic signal) may cause samples to be consistently aligned to a lower value than the actual peak of the signal (refer to the traditional sampling theory explanation); It will then cause an incorrect peak value reading. To avoid this, we derive a couple of phase shifted variations of the signal to ensure that the peak value is ALWAYS the real, measured and perceived value of the signal.

In reality, music never behaves as a sine wave, its also none periodic and therefore I would say that it's safe to use the "none accurate" version of the algorithm for audio purpose since it will yield the same results. For purists and those that not only deal with random signal (such as music), the accurate version is a safer bet.

All this can be very easily understood by using a sine tone generating FS/4 and then feeding the result to both envelopes. You will see that the accurate version will not pump while the other one will.

As the sampling rate increases compared to the measured signal, this problem doesn't exhibit itself.

What's your application?

Best regards

Miguel

Toino Reply
Jul 9, 2016 00:00

Thanks to both of you.

I was intrigued because besides the double of size in Dsp memory cannot measure any difference in my application.

By the way, exponential decay will be a very useful upgrade.

Thank you

J3627 Reply
Jun 12, 2025 00:00

So it's dBFS vs dBTP, in other words? The normal version measures the actual samples while the "Accurate" version interpolates between samples?

DaveThib Reply
Jun 13, 2025 00:00

Hello J3627,

I am not exactly sure what you are asking when you mention dBFS and dBTP? dBFS has to do with a full scale level for a certain number of bits that would represent a full scale signal if all the bits were being used. I assume you mean Total Peak for dBTP? Anyhow, to comment on the rest of your post.

They both measure the actual samples and the accurate version does not actually do any interpolation. It simply phase shifts, which means delays using a filter to get a phase shift. I have not seen the actual code a Miguel who wrote the original response to this either wrote the code or directed someone who did. It would accomplish pretty much the same thing as interpolation but is computationally faster. Then they just take the highest peak value from the direct sampled, and several delayed samples (phase shifted) to come up with the peak value and avoid the peaks that are missed with a sine wave that has a higher frequency that is getting closer to the sampling rate's Nyquist frequency.

At Nyquist you only have two samples to measure the signal! The odds of those samples being right at the peak of the wave is not likely to happen and if it does it is not often so you see the pumping as it is sampled closer or further from the actual peak of the signal. So you may only have three or four samples of a sine wave so the level error can be high. So we phase shift the signal to end up with samples from many places on the wave. Much more "accurate".

Dave T

KJBob Reply
Jun 13, 2025 00:00

Hello Dave and Toino,

SteveL came up with a useful workaround providing an exponential (constant dB/s) decay. It's one of those wonderful ideas that I wish I had thought of. See this thread:

https://ez.analog.com/dsp/sigmadsp/f/q-a/66541/how-can-i-get-a-constant-db-envelope-decay/

Best regards,

Bob

J3627 Reply
Jun 13, 2025 00:00

DaveThib said:
I assume you mean Total Peak for dBTP?

dBTP "decibels true-peak" is the same scale as dBFS but measures interpolated intersample peaks:

https://www.itu.int/dms_pubrec/itu-r/rec/bs/R-REC-BS.1770-5-202311-I!!PDF-E.pdf

ADIApproved said:
we derive a couple of phase shifted variations of the signal to ensure that the peak value is ALWAYS the real, measured and perceived value of the signal

Is that polyphase interpolation?