[sdiy] Fast envelope follower circuit needed..
tom at electricdruid.net
Fri Mar 29 02:20:44 CET 2013
+1. Half-wave leaves more ripple, or needs more filtering = slower response. In this case full-wave is definitely better.
On 29 Mar 2013, at 01:04, rsdio at sounds.wa.com wrote:
> Yes, you can do half wave, and many analog circuits do this. It's mostly about saving costs of components. Software is generally free, though, except for the cost of cycles at run time.
> However, to answer your question about "why bother," the answer is that half wave will put less energy into your LPF, and thus the output level will be less than with full wave.
> In additional, the half wave version will either be less smooth, or it will be approximately half as fast as a full wave.
> The original request asked for 5 V output, and I meant to point out earlier that you'd need at least 2x gain to get 5 V output from an envelope follower that's being fed a 5 V peak-to-peak signal. That's because the signal's average value is around the mid point, and thus the envelope peaks will be half of the peak-to-peak range. Theoretical maximum would be 2.5 V, and in practice it will be less than that with analog implementations because it's difficult to get the capacitor to fully charge after a diode voltage drop and the time constant delay. Digital implementations might be able to produce a peak envelope of 2.5 V for a brief impulse, even for half wave. There's nothing wrong with boosting this by a gain factor of 2, or more, if you really want 5 V envelope output.
> A half wave solution would merely need additional gain to reach 5 V output. However, there is no solution to make the half wave as fast as the full wave.
> Brian Willoughby
> Sound Consulting
> On Mar 28, 2013, at 17:43, Dave Manley wrote:
>> You could also discard all negative samples (half wave). The output goes thru LPF smoothing anyway, why bother with full wave?
>> -------- Original Message --------
>> From: rsdio at sounds.wa.com
>>> On Mar 28, 2013, at 11:24, Tom Wiltshire wrote:
>>>> On 28 Mar 2013, at 13:55, Dan Snazelle <subjectivity at hotmail.com>
>>>>> Though i work with c//arduino/AVRS not pics, this sounds very
>>>>> appealing! Can anyone recommend a place to learn about writing C
>>>>> code for an envelope follower? How do you do it? Shift signal to
>>>>> 0-5, then......
>>>> The first thing after that would be to do the full wave
>>>> rectification. Either dump the sign bit, if you've got signed data,
>>>> or invert the data if the highest bit is clear if it's not signed -
>>>> same thing, different representation. Half-wave rectification just
>>>> makes the signal more "lumpy" and isn't significantly easier
>>>> digitally anyway.
>>> You can't dump the sign bit, at least not with twos-complement data,
>>> which is what all digital signed data is. Maybe you're thinking of
>>> conceptually dumping the negative symbol, but that's not the same as
>>> dumping the sign bit. If you were to dump the sign bit, then the
>>> negative part of the signal would not be inverted, as needed, but
>>> would merely be shifted up into the positive range. That would make
>>> an ugly, spiked signal that would introduce significant errors in
>>> your envelope.
>>> 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.
> Synth-diy mailing list
> Synth-diy at dropmix.xs4all.nl
More information about the Synth-diy