The hardware's very cheap and easy. The "default" synthesis is pretty simple but also pretty hackable (in Rust) if you want to customize it.
The hardware's very cheap and easy. The "default" synthesis is pretty simple but also pretty hackable (in Rust) if you want to customize it.
I did some similar playing around with an ESP32 and I2S a few years ago (lockdowns were an odd time). Where I seem to remember getting stuck was how to get the phase to line up, so that each sample looped at a zero-crossing point (which is different for each frequency).
For the lazy, what did you do?
https://gitlab.com/afandian/melodicornamuse/-/blob/main/melo...
Edit: Ok I glanced at your code, if I read it right it seems like you're writing sin waves into buffers at "init" time then copying the appropriate buffer at "run" time. Which is not what I'd do, but then I'm used to more luxurious devices. Maybe try using a fast sin approximation rather than the precomputed buffer table?
https://bmtechjournal.wordpress.com/2020/05/27/super-fast-qu... might be helpful there.
I much prefer your method of just rotating the phase!
I think the issue with looping at arbitrary points was word alignment. You need to give it a whole buffer. So you'd have to do some nasty bit-shifting.
Per other reply, I think doing it live is probably easisest!
Thanks for the recommendation. If I ever get back into this I'll take a look.