Since all of the recent re-workings of this project have been centered around the idea of a Forth-style stack VM for defining audio operations and resulting synth voices, I decided to finally name the project: Synstack.
The stack VM is pretty functional by now too and heavily inspired by the classic JonesForth, a threaded code implementation of Forth, albeit so far still written in C. More highly useful guidance came from @phaendal's great documentation-forth (even though it's in Japanese) - both of which are probably the most readable Forth implementations I know of. So far no consideration has been given to aiming for ANS Forth compatibility.
The Synstack VM currently clocks in at 24-27KB. This includes some audio related stuff: oscillators, ADSR, IIR filter, foldback distortion, all of which are implemented as native words. The VM also features floating point support, basic string ops and user customizable inlining of Forth words (e.g. to speed up var lookups). Control structures, vars and a basic disassembler are implemented as Forth words.
The audio result of a few variations of the following monophonic synth code can be listened to here:
https://soundcloud.com/forthcharlie/synstack-forth-seq-variations
The final "update" word is repeatedly called by the audio manager to provide the next time slice of 32 samples. So far I found this to be the sweet spot between RAM usage for potentially dozens of operators (especially once polyphonic) and satisfying the Cortex M-7's cache line(s), however the buffer size is customizable. In this example the "update" word also acts as simple probabilistic sequencer, triggering new notes every 150ms w/ 60% chance. On the STM32 this all is triggered via the DMA ISR callbacks, on OSX I'm using Portaudio as audio backend for testing, which uses a v.similar approach...
It's nothing super exciting sounding just yet, but I'm very excited by the possibilities this opens... The first public release of this project is aimed for in mid-April...
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.