[sdiy] VU meter algorithms

Brian Willoughby brianw at audiobanshee.com
Wed Mar 20 07:49:46 CET 2019

One pesky detail that always bothers me about the Nyquist frequency is related to the fact that no filter, analog or digital, has a step response in the frequency domain. Basically, your filter needs to output “nothing” above Nyquist to avoid all aliasing. Thus, you cannot have 0 dB response at Nyquist or even close by.

Thus, I see the Nyquist frequency as a limit that you can approach, but you can never actually reach it. At the very least, you can’t expect full amplitude at the Nyquist frequency.

On your final point, Richie, I’d like to point out that there is always subsequent filtering. Any time you run a digital signal through a DAC, you need a reconstruction filter. That analog filter can produce voltages beyond the range of the DAC. The best DAC products run the analog power supply at least a few volts beyond the DAC power supply to allow headroom for the reconstruction filter. Certainly not all DAC circuits are this well designed, though.

In my estimation, digital signal processing that never gets turned back into an analog signal at the end is kinda pointless. At least I can’t think of an example.

Of course, if you want to recreate the grunge of early digital music gear, you might specifically skip the analog reconstruction filter. But at that point worrying about clipping is rather moot.

Sorry for the off-topic. There’s a lot to be said about VU...


On Mar 18, 2019, at 12:15 PM, Richie Burnett <rburnett at richieburnett.co.uk> wrote:
> Exactly...  The Nyquist Shannon Sampling Theorem says that twice the bandwidth is sufficient to *reconstruct* the original band-limited continuous-time signal.  But it says nothing about how much processing is required to get back to the continuous-time signal, or determining various metrics about that signal like peak amplitude.  So if peaks occur between the samples, (which is almost guaranteed to happen because why would the peaks in the audio signal decide to line up with regular samples) then you will always under-estimate the peak amplitude.  As you said at the Nyquist frequency your peak amplitude measurement could under-estimate by up to 100% depending on the relative phase of the signal being sampled.  So if you don't want to drastically under-estimate the peak amplitude of high-frequency signals you are either going to need to sample the analogue signal at a much higher sample rate _OR_ up-sample (interpolate) the data that you have to find the inter-sample peaks.


> Tom, what do you actually want your "VU meter" LED bargraph to tell you Tom? Is it:
> 1. A visual indication of perceived volume.
> 2. An indication of the peak level of the continuous-time analogue input waveform.
> 3. An indication of whether your ADC clipped.


> The second and third options are peak reading meters, but are subtly different.  Number 3 doesn't care about inter-sample overs because if they didn't occur at a sampling instant then they didn't cause clipping, and won't cause clipping unless you do some subsequent interpolation, phase shifting or filtering.  Number 2 does care about peaks that occur between samples, and needs to use some sort of interpolation to estimate inter-sample levels and indicate them accordingly.

More information about the Synth-diy mailing list