[sdiy] Fast envelope follower circuit needed..

rsdio at sounds.wa.com rsdio at sounds.wa.com
Fri Mar 29 01:14:15 CET 2013


On Mar 28, 2013, at 11:24, Tom Wiltshire wrote:
> Hi Dan,
>
> On 28 Mar 2013, at 13:55, Dan Snazelle <subjectivity at hotmail.com>  
> wrote:
>> 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.

Brian Willoughby
Sound Consulting




More information about the Synth-diy mailing list