[sdiy] Digital VU
Tom Wiltshire
tom at electricdruid.net
Thu Aug 3 23:47:01 CEST 2017
+1 agree with Richie.
If it were me, I’d be looking for a reasonable filter coefficient that I could implement as a bit shift to save a lot of mucking about with “hard sums”. It’s a lot easier to shift a 32-bit number 15 places right than to multiply it by 0.000030517578. Shift it up one place, then throw the bottom two bytes away. Bingo! Donner kebab math! Dirty, but good! Like that, you can keep the higher sample rate, since you’re not doing anything complicated,.
I’d probably also decide that “divide by two” and “-6dB” are close enough that I don’t care and use that to derive LED values directly from bit positions in the result - Richie’s “exponentially-spaced illumination thresholds” . You may not feel the same way, and could tweak it accordingly.
HTH,
Tom
(used to know a few people who were exponentially spaced…)
==================
Electric Druid
Synth & Stompbox DIY
==================
> On 3 Aug 2017, at 19:44, Richie Burnett <rburnett at richieburnett.co.uk> wrote:
>
> You can use simple 1st order IIR digital filters for the attack and decay "ballistics". Sure the cutoff frequency is very low compared to the sample rate, but you just need to make sure you keep track of the current filter state to a sufficient number of bits of resolution.
>
> I would be wary of decimating. You might actually need to do some interpolation if you are to avoid missing peaks that occur at instants that are between samples. Search about "inter-sample overs".
>
> You'll probably also want to do some sort of log approximation too, to make the display scale linear in dB. Or use exponentially spaced illumination thresholds for your LEDs.
>
> -Richie,
>
> Sent from my Xperia SP on O2
>
> ---- Tim Ressel wrote ----
>
>> Hi,
>>
>> I'm looking at doing a VU meter in digital land. Sample the audio and do
>> all the work in code. I am wondering what is the best way to approach
>> the filtering. There needs to be a lowpass filter thingie with a very
>> low cutoff, which makes the ratio of cutoff to sample rate very small.
>> The obvious solution is to decimate the signal and get the sample rate
>> down to a reasonable number. My concern here is the lp filter is low
>> order and tails way out in frequency. Is decimation going to affect its
>> ability to display transients? Another approach is to have a huge FIR
>> filter, but we are talking lots of calculations per sample.\
>>
>> Any thoughts?
>>
>> --
>> --Tim Ressel
>> Circuit Abbey
>> timr at circuitabbey.com
>>
>> _______________________________________________
>> Synth-diy mailing list
>> Synth-diy at synth-diy.org
>> http://synth-diy.org/mailman/listinfo/synth-diy
>
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at synth-diy.org
> http://synth-diy.org/mailman/listinfo/synth-diy
More information about the Synth-diy
mailing list