[sdiy] VU meter algorithms

Tim Ressel timr at circuitabbey.com
Tue Mar 19 07:44:36 CET 2019


How timely, I just ordered the boards for my VU meter.

First off you need to decide which response you want: VU or DIN. There 
is that other new one but it seems too complicated for our purposes. 
They have different attack and decay times. Then your peak hold needs to 
decay slower than that.

If you are going for the all-code option it seems to me the filtering is 
going to get interesting. In analog land the filter cap gets charged at 
one rate and decayed at a slower rate. In code, perhaps an accumulator 
(integrator?) that gets incremented if the detected audio is higher than 
the accumulator value. Otherwise the accum gets decremented at a fixed 
rate, simulating the decay of an analog circuit.

BTW I am using analog detection and filtering. That way I can avoid all 
of this excitement. I just read the value and set the LEDs. Also I am 
using DIN. VU was invented for radio broadcasting to make sure you don't 
clip the transmitter and cause splatter. DIN works better for driving 
cassette tape or wax cylinders.

I hope that Helped.

End of line.

On 3/18/2019 8:25 AM, Tom Wiltshire wrote:
> Hi all,
>
> Does anyone know of any good resources on bargraph VU meter algorithms, and specifically implementing a “Peak hold” feature?
>
> I’m trying to write one - well, I *have* written one - but I’m not overly impressed with its performance. The “VU meter” portion of the code is pretty good: I sample the audio at 40KHz, then rectify it, take the highest sample in a block of 16, and then apply an IIR smoothing filter with a time constant of about 200msecs. That part seems pretty good, although it “under reads” significantly.
> I’m having worse problems with the Peak Hold dot. This has an attack of zero (so it never misses a peak) but uses a longer decay time of 400msecs or so. But a typical input signal tends to make it jump about, so instead of clearly lighting a single LED, it instead lights two or three intermittently. This makes the display rather confusing to look at.
>
> I’d thought to just get stuck in and see how it went (and it went ok) but I think now might be a good time for a bit of research. This is a solved problem, so someone must have dealt with these issues before me.
>
> Thanks,
> Tom
>
>
>
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at synth-diy.org
> http://synth-diy.org/mailman/listinfo/synth-diy

-- 
--Tim Ressel
Circuit Abbey
timr at circuitabbey.com



More information about the Synth-diy mailing list