[sdiy] sine wave floating point conversion issue

Matthew Smith matt at smiffytech.com
Sat Feb 25 20:52:14 CET 2012


I guess, for the sake of completeness, I should ask if you REALLY want 
to be calculating sines at all, unless you have a way overpowered system 
with more spare CPU cycles than you know what to do with.

Don't know what frequency range you will be working over, but if you 
were to set up an array of 4096 integers, rather than go through the 
heartache of doing infinite series to get your sines, you could do FAR 
less math just figuring out when to grab the next value from the array. 
And, as you go up in frequency, what your increment value is - because 
you sure won't need every single one of 4k samples up the top end of the 
keyboard.

I tend to regard working out sines on the fly to be a case of 
re-calculating the wheel, but then I was brought up on Godfrey & 
Siddon's Four Figure Tables ;-)

By the way, Dan, have you considered using an RTOS for this type of 
work?  Whilst I have yet to implement one, my reading suggests that they 
are far less scary than I had thought - and really wish I'd started 
using them before I had started any of my current projects. If you're 
still using AVRs, FreeRTOS is know to work on the ATMega128 (just enough 
RAM.)

Cheers

M

-- 
Matthew Smith

Business: http://www.smiffytech.com
Blog:     http://www.smiffysplace.com
Linkedin: http://www.linkedin.com/in/smiffy
Flickr:   http://www.flickr.com/photos/msmiffy
Twitter:  http://twitter.com/smiffy

ABN 16 391 203 815



More information about the Synth-diy mailing list