[sdiy] Digital VU
rsdio at audiobanshee.com
rsdio at audiobanshee.com
Fri Aug 4 05:20:53 CEST 2017
I realize that the goal is to do all of the work in code. However, I think it's always good to weigh the costs of analog versus digital for each subsection of the solution.
The biggest reason that I recommend handling at least some of the processing in the analog domain is that some of it is almost free. Any audio input will require anti-alias filtering before the A/D. At least some analog circuitry will be required for that. Thus, if the VU integration time constant is implemented as a low-pass filter, then you've killed two birds with one stone. The same analog filter can satisfy both Nyquist and the VU integration time constant, and you can significantly reduce the sample rate and CPU load. The only additional components would be some diodes to rectify the audio signal before the filter.
I have a question for Tim: How do you envision the Peak Hold?
If you want a literal VU meter, then the typical Peak indicator is an LED with a fixed threshold at or near clipping. That's why I suggested a comparator feeding a GPIO pin. This would allow your A/D input to be filtered to a low frequency response while the comparator is fed by the unfiltered audio. Your software can implement the Hold function without requiring a 555 Timer or other analog solution. You could even wire-OR the LED to be driven by both the comparator and the GPIO.
If you want a PPM meter to DIN standards, then the Peak indicator is probably going to be a moving peak that simply shows the most recent extreme. In this case, the low-pass might be a bad idea because it might remove peaks, but you'd still need an anti-aliasing filter.
On Aug 3, 2017, at 5:49 PM, Tom Wiltshire wrote:
> Analog processing is another possible solution, but the original brief ruled it out pretty thoroughly, so I didn’t consider it: "I'm looking at doing a VU meter in digital land. Sample the audio and do all the work in code.”
> I based my answer on that and assumed the minimum hardware to get the job done. More is always nice…;)
> On 3 Aug 2017, at 23:41, Brian wrote:
>> Getting back to Tim's original question, I'd recommend handling some or almost all of the processing in the analog domain since the circuity would be rather simple. First of all, you could use a simple comparator to feed the typical VU Peak (clipping) indicator, driving an LED and a GPIO on the processor. In addition, full-wave rectification can be done with diodes and op-amps ahead of the A/D input. This allows you to feed a bipolar audio signal into a positive-only A/D without DC-biasing, which could really simplify things in a Euro setup. Finally, some simple RC filtering would help both with Nyquist requirements and to satisfy the VU smoothing requirements. The resulting analog signal could be sampled at a much lower rate, leaving only minimal calculations for a bar graph with moving peak.
>>>> ---- Tim Ressel wrote ----
>>>>> 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?
More information about the Synth-diy