[sdiy] Fast envelope follower circuit needed..

Tom Wiltshire tom at electricdruid.net
Fri Mar 29 13:03:54 CET 2013


On 29 Mar 2013, at 09:06, cheater cheater <cheater00 at gmail.com> wrote:

> Brian & Co.,
> 
> On Fri, Mar 29, 2013 at 1:14 AM,  <rsdio at sounds.wa.com> wrote:
>> The easiest thing to do with signed data is use abs() to get the absolute
>> value. Many 8-bit processors even have a native opcode to compute abs(), but
>> they're not merely masking out the sign bit as would be done by and'ing with
>> 0x7F.
>> 
>> You are correct that inverting the data below the midpoint will work with
>> unsigned data.
>> 
>> You can probably use almost exactly the same code for either signed or
>> unsigned.
> 
> why bother? The noise floor and inharmonic distortion introduced by
> this process, done much more easily in an analog front-end, will be so
> severe that the whole device will produce erroneous, un-musical
> output.

You made this claim previously, but I don't see the problem.

It's true that doing rectification in the digital domain will introduce aliasing - but so what? Imagine we sample at 20KHz, and we've got a 440Hz sine wave coming in. We rectify and get a waveform that looks like a series of little hills and valleys at 880Hz. Those little valleys are sharp spikes that will cause aliasing.
But why do I care? I'm not going to listen to the result. In fact, the only information I do care about is the height of those hills, and I haven't altered that at all. Once I derive the height of those peaks, I'm going throw that signal away. It won't ever see the light of analog day, and it certainly won't reach my ears, so I don't see how it can be "unmusical".

As to "easier in an analog front end", a typical precision op-amp full wave rectifier requires two opamps plus a few resistors and diodes. It isn't complicated, but it's complicated enough that (as has already been mentioned) several commercial implementations use a simpler half-wave rectifier despite the drawbacks.
Doing rectification in software is two instructions, or one if you've got a handy "abs" instruction. So, no, it's easier digitally. About the only argument I can see for doing it before the ADC is that it would provide protection against negative signals, which offsetting the input perhaps wouldn't.

Tom






More information about the Synth-diy mailing list