This is an old revision of the document!
Faust (Functional Audio Stream) is an open-source, functional programming language, specifically designed for real-time audio signal processing and synthesis. Faust generates C++, as well as other target languages, for signal processing applications.
The Faust library provides a rich set of audio DSP objects that can be used in creating DSP algorithms. Using Faust, it is possible to quickly create large algorithms that take advantage of the computing power available on the SHARC Audio Module platform.
Not only can Faust generate efficient inner loops in C++, it also:
This document will not go into detail about the Faust language. There are a number of good references and tutorials for Faust. Here are some useful references for learning more about Faust.
The new Faust Online Editor can be used to edit, compile, and run Faust code from any modern Web Browser with WebAssembly support. All prototyping is done in a web browser and the browser can export C++ code targeted for the SHARC Audio Module platform.
Faust programs may be targeted for many different platforms via what is known as “an architecture”. Internally the script faust2sam calls the Faust compiler using an architecture that is specific to the SHARC Audio Module platform. When an algorithm is compiled using faust2sam, three C++ source code files are generated for the SHARC Audio Module platform. These files may then be inserted into the baremetal framework Cross Core Embedded Studio (CCES) workspace to be compiled into an algorithm that runs on the SHARC Audio Module platform.
In order to have a successful experience using Faust, certain hardware will be needed.
LINE OUTof the SHARC Audio Module
LINE INof the SHARC Audio Module
MIDI INof the Audio Project Fin
DEBUGheader on the SHARC Audio Module
P3of the SHARC Audio Module
The SHARC Audio Module Bare Metal framework is a light-weight C / C++ framework designed for efficient audio signal processing using the ADSP-SC589 processor on the SHARC Audio Module main board. Users can easily run their Faust algorithms using the bare metal framework.
Faust algorithms can be added to this framework in the
The CCES Baremetal Framework has a subproject directory for each processor core:
For each project directory there is a directory where the three source files created from the Faust online editor should be placed.
It is easy to get up and running with a new project in CrossCore Embedded Studio using the bare metal project wizard.
The following options should be selected when using the wizard:
No other options need to be changed.
In addition there is a header file that is common across all cores called
audio_system_config.h. In this file the following pre-processor macros should be set. The example below indicates that a Faust algorithm will only be running on Core1 and that Core2 will be simply passing audio to the codec.
#define SAM_AUDIOPROJ_FIN_BOARD_PRESENT TRUE #define FAUST_INSTALLED TRUE #define USE_FAUST_ALGORITHM_CORE1 TRUE #define USE_FAUST_ALGORITHM_CORE2 FALSE
This document will not go into extensive detail on how to use CCES. Please go through the CCES Getting Started Guide if looking for more detailed information on using CCES. However here are some brief notes on how to work with this algorithm.
faustdirectory for the core that the algorithm will run on.
audio_system_config.hpreprocessor macros as described.
File> Import> General> Existing Projects into Workspaceto import the projects for each core into the workspace.
Project> Build Project(This may take a few minutes)
Faust has a number of meta data conventions for mapping MIDI messages into Faust control. Below is the simple MIDI controlled sawtooth synth, which illustrates how this control mapping is done. In the example below nentry() is a numerical entry object that can be mapped to receive specific MIDI values. A number of metadata values are reserved to have specific mapping functions.
freq– If a MIDI noteOn event is received it’s MIDI keyNumber is mapped to a frequency.
bend– if a MIDI pitchBend message is received it is mapped to a bend value.
gain– if a MIDI noteOn message is received it’s velocity value is mapped to a gain value which ranges from [0 .. 1.0]
gate– if MIDI noteOn/noteOff messages are received they are mapped to a gate value (0/1)
[midi:ctrl 1]– A Faust control (slider, etc.) can be mapped to listen to a MIDI continuous controller.
The pots and push buttons on the Audio Project Fin can be used to control key algorithm parameters. The pots and push button switches are mapped to default continuous controllers.
The algorithm examples that are provided use these conventions. For example, the effects algorithm is “echo : flange : chorus : reverb”. For this algorithm each of the four push buttons turns on a different effects unit. The first pot is the echo feedback, the second pot is the reverb room size and the third pot is the reverb damping.
The typical workflow using faust to design algorithms for the SHARC Audio Module is:
*.dspfile appropriately for the algorithm being created.
Export/compile to a specific platformbutton
faustdirectory in the CCES framework. The framework can then be compiled and downloaded to the SHARC Audio Module.
Here is a block diagram of how the code for the virtual analog synthesizer demo and the effects chain is organized.