[sdiy] VU meter algorithms
tom at electricdruid.net
Mon Mar 18 20:21:38 CET 2019
> On 18 Mar 2019, at 17:46, Scott Gravenhorst <music.maker at gte.net> wrote:
> Reading this, (and in my naivete) I wonder if part of this could be mitigated by doing
> some analog processing before the digital sampling. Something like a full wave
> rectifier of the signal with a low pass filter that has a leak resistor? Then I think
> the sample rate could be much lower than 40 kHz? As I said - naivete...
Absolutely, and that’s a very valid course of action. I’ve seen designs that work that way. It reduces the demands on the processor enormously, which is why it appeals.
However, if you can do a full wave rectifier and filter in the analog domain, why can’t you do it in the digital domain?! More PIC-Based fun, right? So that’s what I’ve been trying. To minimise the overhead, the filters are simple shift-based things (so no massive selection of cutoff frequency/time constant). Hacky but it works.
>From what I’ve discovered, the best source of information about the various different VU Meter and Peak Program Meter standards is actually the LM3916 datasheet! The later pages of this describe full wave rectifier circuits with the required time constants for many commonly used systems. Very useful.
This enabled me to determine that for my purposes (allowing a level to be set as loud as possible but low enough to prevent clipping) what I really need is a Peak Program Meter, not a VU Meter (too slow - doesn’t catch transients).
I’ve got this running on a PIC 16F1503, and I really only needed to decide what time constants I needed for the attack and decay. I think I’ll be running with “instant” for the attack and about 400msecs for the decay. This doesn’t match any current standard, but it works fine for what I need so I’m happy for now.
More information about the Synth-diy