I've begun to implement the very basics of the FAUST language in ATS. FAUST is a very elegant
functional language for audio/signal processing. The syntax is based on a certain "block diagram algebra",
where a block is like a black-box function with some number of input signals and some number of outputs,
and the algebra is given by five "composition" operations for grafting together inputs and outputs. The block
diagram algebra can be mathematically explained as a (wheeled) PROP or as an form of arrow enrichment.
I've done a lot of mathematical research on PROPs, properads and the like, so recreating this in a programming
language is something I'm very enthusiastic about.
In FAUST the in-/outputs are audio signals and the blocks are audio processors. FAUST is written in C++
and is very performant, but it is also very limited in what type an audio signal can be given. (Essentially, only
streams of ints or floats, I believe). My idea is that it should be possible to give a very direct implementation of
the block diagram algebra in ATS, that works for signals of any [viewt0ype].
My code so far is here:
https://github.com/August-Alm/ATS-Experiments/blob/master/faust.datsEverything works just fine except the most elusive of the five operations: the [recursive_composition] which grafts
in- and outputs into a feedback loop. The compiler says:
$ patscc -DATS_MEMALLOC_LIBC -o faust faust.dats
faust_dats.c: In function ‘__patsfun_32__32__1’:
faust_dats.c:9229:1: warning: implicit declaration of function ‘__patsfun_32__32’ [-Wimplicit-function-declaration]
ATSINSmove(tmp81__1, __patsfun_32__32(env0, env1, env2, arg0)) ;
^
In file included from faust_dats.c:15:0:
/usr/lib/ATS2/ccomp/runtime/pats_ccomp_instrset.h:270:35: warning: assignment makes pointer from integer without a cast
#define ATSINSmove(tmp, val) (tmp = val)
^
faust_dats.c:9229:1: note: in expansion of macro ‘ATSINSmove’
ATSINSmove(tmp81__1, __patsfun_32__32(env0, env1, env2, arg0)) ;
^
/tmp/ccF3c5gZ.o: In function `__patsfun_32__32__1':
faust_dats.c:(.text+0x21e1): undefined reference to `__patsfun_32__32'
collect2: error: ld returned 1 exit status
I've tried everything that I can think of. In the github code I use [int]-signals but I've tried boxed types as well, and
various other things. I've meticulously annotated all templates, and so on. Always the same compiler error. Any suggestions?
Best wishes,
August