Tuesday, August 6, 2013

sin(sin(x))


Well into a little bit of DX VCO... The DAC works, the FPU works, the SPI works, some fairly basic code works and we end up with this! Did cheat a little and end up using a lookup table rather than a Taylor series. Since I really don't need the resolution and when you start scratching the surface the Taylor Series is a reasonable amount more mucking around than it appears and to try and run this as fast as possible I pinched some table generation stuff that I used for the LFO a while ago and re-jigged it a little bit. This is about 400Hz and the sample rate is up around 176kHz with a 16 bit resolution. Now need to get the ADC going...

1 comment:

haker m said...

Taylor series is simple to understand but not really well suited for approximation. You'd rather want to minimise maximum error, not keep error at zero (like Taylor does).
https://www.pseudorandom.com/implementing-exp
this is very good blog post about function approximation.
I assume you implement it on quite new CPU, if so keep in mind instruction latency. intuitive implementation of taylor series, a+ x(b+ x(c+ xd)) is quite slow, as every MAC instruction needs to wait for last one to retire