[sdiy] Fast envelope generation

Tom Wiltshire tom at electricdruid.net
Thu Dec 20 17:27:22 CET 2012


Hi Neil,

>>>> You can read the curve as a interpolation index x, and then do the following linear interp calc:
>>>> 
>>>> y = ((1-x) * start) + (x * end)
>>>> 
>>>> This gives you the curve between the two points 'start' and 'end' and saves the scaling, for the cost of two multiplies. Since you can read any lookup table, you can insert any curve between the two points for no more work.
>>> 
>>> As always the devil is in the details....
>> 
>> Sorry Neil, you've lost me. What do you mean?
> 
> Assuming the code on your website is current then I believe there's a
> rounding bug in your interpolation routine.

For the env gen? You mean this one? -

http://www.electricdruid.net/code/ENVGEN7B.ASM

The interp for that doesn't use the formula above. It does the offset and scaling separately, because I didn't know better at the time I wrote it. There may well be a rounding bug, since mostly it doesn't round at all - it truncates. What have you spotted?

And thanks for taking the time to look - appreciated.

Regards,
Tom




More information about the Synth-diy mailing list