[sdiy] Wavetable Design Update
Tom Wiltshire
tom at electricdruid.net
Thu Feb 3 10:35:12 CET 2011
On 3 Feb 2011, at 07:41, Paul Maddox wrote:
> it's one of those things that the moment you get it you'll kick
> yourself at how obvious it is :-)
I agree. I struggled with the concept at first too, and remember how difficult it seemed. But once you understand it, it seems much simpler! (I guess *most* things are like that, actually...)
There's a bit about phase accumulators on my website too:
http://www.electricdruid.net/index.php?page=info.dds
The significant thing about the timing the way Paul is suggesting doing it is that it is as fast as possible. There's no timer or interrupt, just a small loop of instructions that run over and over again. If you can make that loop *very* small (like 10 instructions or so) then you get a very fast sample rate. The timing is implicit - a given number of instructions take a given time at a given clock rate.
There's a trick I learned recently for dealing with phase accumulator overflow in C without being able to get at the carry flag. If you've just added a freq increment "inc" to a phase accumulator "phase", then you can test:
if (phase<inc) {
// Must have overflowed
}
HTH,
Tom
More information about the Synth-diy
mailing list