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, and audio effects. Faust targets high-performance signal processing applications and audio plug-ins for a variety of platforms and standards.
Faust has experimental support for Bela.
Table of contents
- Setting up Faust on Bela
- Learn more
Setting up Faust on Bela
Enabling Faust on Bela requires some setup on your computer and your Bela system. This is because Faust generates very large C++ files that may take several minutes to compile on Bela system. To mitigate this, we strongly recommend that you offload compilation to your comptuer by setting up
distcc (you can read more here).
This setup is done on your computer’s command line. Pre-requisites:
PkgConfig. On a Mac these can be installed with
brew, and on Linux with
1. Download, build, and install Faust
git clone https://github.com/grame-cncm/faust.git &&\ cd faust &&\ make -j4 &&\ sudo make install
The development of Faust proceeds at a very fast pace, so occasionally things are broken. The latest known working commit is
c2a6f90c50b1815e0e9d8eddcaec8640148856a4, so if you get a compilation error while building the Bela program below, try to add
git checkout c2a6f90c50b1815e0e9d8eddcaec8640148856a4 before
make -j4 above, and re-run the two
2. Set up
We strongly recommend setting up the
distcc cross-compiling environment to avoid long build times. Follow the instructions here.
3. Configure your Bela system
Next, you need to install a library on your Bela system that will allow you to interact with the Faust GUI in the browser.
First, download this file, a pre-compiled version of the http library that comes with Faust. Then, on your computer’s command line, run these lines to unzip your download and copies it to your Bela board (replace
/path/to with the path to your download):
$ unzip libHTTPDFaust.zip $ ssh email@example.com rm -rf /usr/local/lib/libHTTPDFaust.* $ scp libHTTPDFaust.so.*.* libHTTPDFaust.a firstname.lastname@example.org:/usr/local/lib/ $ ssh email@example.com "cd /usr/local/lib && ldconfig && ln -s libHTTPDFaust.so.? libHTTPDFaust.so"
libmicrohttpd-dev on your Bela system. Make sure your board is connected to the internet and run
apt-get install libmicrohttpd-dev
Compiling and running projects
On your computer, go into
faust/examples/bela and run:
$ faust2bela -tobela simpleFX_Analog.dsp
This builds and runs the project. Plug some signal into your Bela system’s audio inputs and you will hear it processed through drive, flanger, reverb! Bela’s analog inputs control some of the parameters.
Using the Faust GUI
To use the Faust GUI you can run the same command as above, but add the
$ faust2bela -tobela -gui simpleFX_Analog.dsp
Access the Faust GUI in a web browser at
http://192.168.7.2:5510. Some of the parameters displayed are controlled by Bela’s analog inputs and can’t be controlled through the GUI. Others can be controlled in rea time using the GUI. Here’s what the Faust GUI looks like:
Using Faust with MIDI devices
To use external MIDI devices, pass the
-midi -nvoices option:
$ faust2bela -tobela -midi -nvoices 4 -gui /path/to/faust/file.dsp
Using Bela’s analog and digital pins
To interface Bela’s analog and digital inputs, you need to edit the labels to follow the naming scheme:
freq = hslider("Frequency[BELA:ANALOG_0]", 440 ,460, 1500, 1) :smooth(0.999); pressure = hslider("Pressure[style:knob][BELA:ANALOG_4]", 0.96, 0.2, 2.0, 0.01) :smooth(0.999):min(0.99):max(0.2); gate = hslider("ON/OFF (ASR Envelope)[BELA:DIGITAL_0]",0,0,1,1);
The Faust playground: an online playground to experiment with connecting together Faust patches