faust
faust copied to clipboard
Compiling with int's
Hi! I'm trying to make some test of faust on microcontrollers that don't have a FPU, i was wondering if there was anyway to compile the faust code using int's, or to modify the code afterwards. Would something like defining FAUSTFLOAT uint16_t work? I imagine it would be more complex and maybe converting a lot of things manually, but I have no idea. This paper shows how they did some experiments on the Teensy 3.2 which doesn't have a FPU unit and manage to, quote, "by hand" re-write the compiled code to use fixed point without changing the original FAUST DSP file. However, they don't go into details on the changes they performed. Does anybody know?
You can possibly use the -fx (fixed-point) option that will use the fixpoint_t type for samples. Then add a proper definition forfixpoint_t and associated arithmetic, like showed in a limited way in https://github.com/grame-cncm/faust/blob/master-dev/architecture/minimal-fixed-point.cpp architecture file. Then use faust -a minimal-fixed-point.cpp -fx foo.dsp to generate a C++ file.
You can possibly use the
-fx(fixed-point) option that will use thefixpoint_ttype for samples. Then add a proper definition forfixpoint_tand associated arithmetic, like showed in a limited way in https://github.com/grame-cncm/faust/blob/master-dev/architecture/minimal-fixed-point.cpp architecture file. Then usefaust -a minimal-fixed-point.cpp -fx foo.dspto generate a C++ file.
In that case should I create the file "ap_fixed.h"? Also, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs in compute: being floats wouldn't pose a problem?
minimal-fixed-point.cppfile is given as an example, you'll have make a new version for you use case and adapt it- you'll have to define
FAUSTFLOATin your adapted architecture file. Read https://faustdoc.grame.fr/manual/architectures/ for a general info