[sdiy] Approximating sine with plain integer math

rsdio at audiobanshee.com rsdio at audiobanshee.com
Thu Apr 7 03:16:18 CEST 2016


Your code is fine from -180 degrees to +180 degrees, which sort of solves the 270-degree overflow. It seems to be valid for exactly one period of the ramp wave input, from negative peak to positive peak, then it falls apart.

Brian

On Apr 6, 2016, at 4:38 PM, John Ames <commodorejohn at gmail.com> wrote:
> Just realized my code sample causes a divide-by-zero due to my lazy
> derivation of the sign. (You'd think that'd be a C standard library
> function...) Also, it does overflow after all, around the 270 degree
> mark. The first is an easy fix; the second, not so much. I'll need to
> give this some more thought.


More information about the Synth-diy mailing list