Implementing a Decay Curve Generator into Microprocessor

In the previous article, I considered how to calculate a decay curve without using a lookup table. I tried implementing it to a microprocessor (atmega168). But I hit a few obstacles. First I planned to keep envelope value as a Q10.6 fixed point number (meaning 10 integer bits and 6 fractional bits), so that I can conveniently use a 16-bit integer. But I found it does not give enough resolution of the data. I needed to extend it to 32-bit (Q10.22). Integer part is enough with 10 bit because it's the resolution of the PWM output. Then I wrote a program like following (shortened from the actual program). It looks…

Calculating a Decaying Exponential Curve Recursively by using Fixed Point Multiplication

I've been working on implementing Envelope Generator into microprocessors. Output of an Envelope Generator consists of rising and falling exponential curve. I'm currently doing table lookup to generate those curves. https://github.com/naokiiwakami/vceg This is a quick and straightforward approach, and you don't have to be worried much about data resolution. But the program is a little complicated, and memory consuming. I don't really like this approach. I don't really like the approach, so I started to think about alternative approaches. Mathematically, a exponentially decaying curve can be calculated recursively by following formula: V(i+1) = V(i) * k where 0 <= k < 1 This is very simple. You can program this…