[sdiy] Synstack - Forth based audio DSL for STM32
Karsten Schmidt
info at toxi.co.uk
Tue Mar 1 19:33:12 CET 2016
Thanks for all the comments & apols for slow response... I will try to
address all points raised in one go:
Forth was one of the first languages I learned too in the late 80s
(after learning to code in hex & asm), but never really did anything
worthwhile with it. As Pete & Terry have already pointed out, Forth is
stack based and therefore uses post-fix notation (but it's FILO, not
FIFO!). The stack is used as main abstraction to pass data between
different operations. You push data (or code) onto the stack, then
some "function" (in Forth they're called "words") picks up 0 or more
elements from the stack and places its results (if any) back on. Some
words even just re-arrange the top N stack items (e.g. duplicate,
swap, rotate etc.). There's almost no syntax in Forth either,
basically any whitespace separated symbol is a word: In minimal
builds, only a handful of words need to be implemented natively, the
rest of the language features (incl. control structures like if/then,
iteration, recursion etc.) can all be expressed in Forth directly...
The Unix pipeline approach is actually very similar to Forth, however
is limited to a stack depth of 1 (whereas in Forth it can be as deep
as you wish, though seldom it's more than 4 - 8 at a time)
I think for audio / DSP coding this is super powerful and instead of
building DSP graphs, we simply build pipelines using a proper language
with all the abstraction possibilities this entails. Apart from slowly
rewriting core parts in Asm, my current focus is defining/refactoring
the base digital audio generation vocabulary to be more concise and
start building a set of examples for the first release. After that,
it's building out support to interact with the various STM peripherals
directly and support live coding.
My main reference points (in no particular order):
http://4klang.untergrund.net //
https://www.youtube.com/watch?v=ifhUsy2jEhc //
https://www.youtube.com/watch?v=wP__g_9FT4M
http://amforth.sourceforge.net
http://mecrisp.sourceforge.net/
https://github.com/philburk/hmsl
https://github.com/erlehmann/libglitch
http://pelulamu.net/ibniz/
https://github.com/PaulBatchelor/Sporth
https://github.com/boomlinde/acidforth
Hth!
K.
On 25 February 2016 at 16:32, KA4HJH <ka4hjh at gmail.com> wrote:
>
> On Feb 25, 2016, at 10:50 AM, Sarah Thompson <plodger at gmail.com> wrote:
>
>> Forth cool is.
>>
>> Forth-syntax weird is.
>
> calculators
> RPN
> like
> rather
>
> based
> stack
> FIFO
> is
> Forth
>
> Terry Bowman, KA4HJH
> "The Mac Doctor"
>
> "Easy being green, it is not"—Yoda to Kermit
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at dropmix.xs4all.nl
> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy
--
Karsten Schmidt
http://postspectacular.com | http://thi.ng | http://toxiclibs.org
More information about the Synth-diy
mailing list