Compiling Faust code for Bela » History » Version 6

Giulio Moro, 2016-04-28 02:15 PM

1 2 Giulio Moro
h1.  Compiling Faust code for Bela
2 1 Giulio Moro
3 1 Giulio Moro
We currently have beta support for Faust on Bela. Sorry, we do not have much documentation at the moment, but the below should be fine to get you started, whether or not you are familiar with Faust.
4 1 Giulio Moro
5 3 Giulio Moro
Go to http://faust.grame.fr/faustplayground and find some example patches in the BIBLIO and drop them on the playground, connect the audio output to preview in the browser, hit export->select Bela->exporter to build and then "telecharger" to download the compiled binary.
6 4 Giulio Moro
Alternatively, you can use the online compiler http://faust.grame.fr/onlinecompiler, from where you can also download the Bela architecture file created by Oli Larkin and Stéphane Letz.
7 3 Giulio Moro
8 6 Giulio Moro
*Important:* the instructions above will work only if you have the *testing* release of our image (https://github.com/BelaPlatform/bela-image/releases). If you are running an older version, in order to run Faust code, you will have to download the C++ file generated by the onlinecompiler (after setting the -i flag) and either paste it into an IDE project or save it on your computer and build it with the build_project.sh script, as in
9 3 Giulio Moro
<pre>/path/to/bela/repo/scripts/build_project.sh /path/to/faust/file/CppCode.cpp</pre>
10 1 Giulio Moro
11 5 Giulio Moro
Given the nature of the C++ code generated by Faust, this would usually take quite some time to be compiled on the BeagleBone Black. If you are experiencing excessively long compile times, try cross-compiling, as explained in [[ Compiling Bela projects in Eclipse]].
12 5 Giulio Moro
13 1 Giulio Moro
To interface Bela's analog and digital in, you need to click the edit button on a patch to edit it. Unfortunately because of a bug you need to save the edited text to a .dsp file and then drag and drop it back on the playground page.
14 1 Giulio Moro
15 1 Giulio Moro
See the attached file as an example. You need to use the [BELA:ANALOG_0] or [BELA:DIGITAL_0] label , as in :
16 1 Giulio Moro
<pre>
17 1 Giulio Moro
freq = hslider("[1]Frequency[BELA:ANALOG_0]", 440,460,1500,1):smooth(0.999);
18 1 Giulio Moro
pressure = hslider("[2]Pressure[style:knob][BELA:ANALOG_4]", 0.96, 0.2, 2.0, 0.01):smooth(0.999):min(0.99):max(0.2);
19 1 Giulio Moro
gate = hslider("[0]ON/OFF (ASR Envelope)[BELA:DIGITAL_0]",0,0,1,1);
20 1 Giulio Moro
</pre>