-
-
Notifications
You must be signed in to change notification settings - Fork 295
Faust
Faust (Functional Audio Stream) is a functional programming language for sound synthesis and audio processing with a strong focus on the design of synthesizers, musical instruments, audio effects, etc. Faust targets high-performance signal processing applications and audio plug-ins for a variety of platforms and standards.
The core component of Faust is its compiler. It allows to "translate" any Faust digital signal processing (DSP) specification to a wide range of non-domain specific languages such as C++, C, LLVM bit code, WebAssembly, Rust, etc. In this regard, Faust can be seen as an alternative to C++ but is much simpler and intuitive to learn.
We use Faust to generate a C++ file that we can include in our Arduino sketch.
The following scenarios are supported:
- Faust generates output sound (see the noise example)
- Faust uses input sound to generate the output result (see the guitarix example)
- Open the web IDE and write or load your Faust Program.
- Click on the Export (the one with the Truck!)
- In Platform select source
- In Architecture select cplusplus
- Click on Compile
- Clock on Download
- Rename the generated cpp file to .h and move it to the Arduino Sketch Directory
You can generate the C++ code with the help of the command line.
- Install the Faust Compiler (https://faust.grame.fr/downloads/
- Now you can compile a dsp file to a h file with
faust filename.dsp -o filename.h
The RAM of the microcontrollers is limited and Faust sometimes generates code which does not fit into the available RAM. The ESP32 AudioKit and ESP32 WROVER modules have PSRAM that can be used. In order to use PRSAM we need to use the memory manager. An example how to do this can be found in streams-faust_flute_i2s!
In this case we need to use the -mem option when we compile the sketch to cpp code:
faust -mem fluteMIDI.dsp -o fluteMIDI.h