[sdiy] Fast envelope follower circuit needed..

cheater cheater cheater00 at gmail.com
Fri Mar 29 18:23:04 CET 2013


Hi Tom,

I'm afraid I have to disagree with you on several points here.

On Fri, Mar 29, 2013 at 1:03 PM, Tom Wiltshire <tom at electricdruid.net> wrote:
>
> On 29 Mar 2013, at 09:06, cheater cheater <cheater00 at gmail.com> wrote:
>> 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.

And they contain wide-band content of very high energy. Bear in mind -
this is crucial - that an envelope follower is just an asymmetric
low-pass filter in its most basic form. Its response is going to be
very frequency dependent. Feeding it with a signal that's mutilated in
the frequency domain is going to do a lot of damage to its operation.

The Hilbert transform approach Richie mentioned above is also
frequency-dependent.

> But why do I care? I'm not going to listen to the result.

Oh, but yes you are. The aliasing doesn't only go above the base
frequency of the wave, but below it as well. You'll get rumble in the
envelope output.

But even at -36 dB, which is a good approximation for the amount of
inharmonic content introduced by the aliasing after the enveloping has
been applied, this error easily introduces inharmonic content into
whatever that detected envelope is going to modulate. If you're using
it to modulate an amplifier, then it's like adding a fairly quiet (but
not absent) oscillator at some unrelated pitch that'll break all your
harmonies. Similarly when frequency modulating a filter.

So you have rumble and high-frequency buzzing. And as your melody
progresses, that rumbling and buzzing will play another melody,
harmonically unrelated to it, messing up any sort of arrangement you
were trying to create.

> 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".

That's the thing, filters don't work this way. They take every part of
the signal into consideration, not "just the peaks". Those parts of
the signal end up in the output of the filter depending on their
frequency content and power. When the aliasing happens, all the
instantaneous power of the signal (and more, depending) is being fed
into the filter above its cutoff frequency. The filter will be unable
to reject it all (because you don't want to use steep filters for
envelope following) and thus you end up with the junk in your output,
modulating the rest of your sound.

> 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.

You got that right. But do you know what it takes to do rectification
in software *properly*? I don't. It's still being figured out, expect
to see new papers every now and then. But even taking the most usual
good-sounding approach that's used in most new synths, i.e.
band-limited transient reconstruction: it's a shitload of work and
requires a huge amount of processing (huge compared to the little PIC)

> 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.

Of course it's easier to "do". But it's not easier to do.

Cheers,
D.



More information about the Synth-diy mailing list