<div dir="ltr"><div><div>Here is a somewhat different approach, its very lean on CPU cycles, but is only useful for generating visual feedback.<br></div><div><br></div>- For a period of around 1/10th of a second, (about 4000 samples) find the maximum value.<br></div><div>- Map the max value you found to the display.<br></div>- Zero the max value and start over for the next 4000 samples.  <br><div><div><br></div><div>This works for both signed and unsigned samples. <br>For visual feedback the 1/10 second latency is not a problem.<br>The large number of samples is needed because one or more periods of the lowest expected frequency should "fit inside" to prevent jitter on the display.<br><br></div><div>Next the mapping, this might be a open door but anyways...<br><br></div><div>To map the values to the display (LEDs) it may be useful to use multiple short lookup tables instead of a single big one.<br></div><div>So if your value us 16 bit long, instead of using one table with a 16 bit index, use two tables with a 8 bit index.<br></div><div>First look at the high byte: <br>    - IF the high byte is non zero: use the high byte as index for table1 to control the LEDs. <br></div><div>    - ELSE: use the low byte and table2. <br></div><div><br>With 24bit values, use 3 tables in the same way.<br>Shifting out the lower bits first may help to further reduce the lookup table size you need.<br><br><br></div><div>Hope this helps,<br></div><div>Theo <br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 3, 2017 at 7:57 PM, Tim Ressel <span dir="ltr"><<a href="mailto:timr@circuitabbey.com" target="_blank">timr@circuitabbey.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
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.\<br>
<br>
Any thoughts?<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
--Tim Ressel<br>
Circuit Abbey<br>
<a href="mailto:timr@circuitabbey.com" target="_blank">timr@circuitabbey.com</a><br>
<br>
______________________________<wbr>_________________<br>
Synth-diy mailing list<br>
<a href="mailto:Synth-diy@synth-diy.org" target="_blank">Synth-diy@synth-diy.org</a><br>
<a href="http://synth-diy.org/mailman/listinfo/synth-diy" rel="noreferrer" target="_blank">http://synth-diy.org/mailman/l<wbr>istinfo/synth-diy</a><br>
</font></span></blockquote></div><br></div></div>