Home

Awesome

FaucK

FaucK is a Chugin that combines the powerful, succinct Functional AUdio STream (Faust) language with the strongly-timed ChucK audio programming language. FaucK allows programmers to evaluate Faust code on-the-fly inside ChucK and control Faust signal processors using ChucK’s sample-precise timing and concurrency mechanisms. The goal is to create an amalgam that plays to the strengths of each language, giving rise to new possibilities for rapid prototyping, interaction design and controller mapping, pedagogy, and new ways of working with both Faust and ChucK.

Compatibility note: FaucK requires ChucK 1.5.2.0 or higher.

Compilation requirements

Compilation requirements for all platforms

You must install cmake and git so that they're accessible in Terminal/cmd prompts.

You may need to execute git submodule update --init --recursive in the fauck directory to make sure all submodules are cloned.

macOS requirements

Install the dependencies for libsndfile with brew:

brew install autoconf autogen automake flac lame libogg libtool libvorbis opus mpg123 pkg-config

Linux requirements

Install the dependencies for libsndfile:

sudo apt install autoconf autogen automake build-essential libasound2-dev \
libflac-dev libogg-dev libtool libvorbis-dev libopus-dev libmp3lame-dev \
libmpg123-dev pkg-config python

Windows requirements

Building FaucK

macOS

In the root of this repository, run

make mac

Afterward, a Faust.chug directory will appear at ~/.chuck/lib/Faust.chug.

Linux

In the root of this repository, run

make linux

Afterward, a Faust.chug file will appear at ~/.chuck/lib/Faust.chug. Next, download https://github.com/grame-cncm/faustlibraries next to the Faust.chug and name it faust.

Windows

Open an x64 Native Tools Command Prompt for Visual Studio 2022, navigate to the root of this repository, and run

make win

Afterward, the file Faust.chug and directory faust should be in %USERPROFILE%/Documents/ChucK/Chugins.

Navigate to this repository's package directory and find the latest fauck version such as fauck-0.0.1. You should see a file sndfile.dll, which you should copy next to wherever chuck.exe exists on your computer (likely C:/Program Files/ChucK/chuck.exe).

Using FaucK

FaucK objects can be used easily in any ChucK code through a Chugin called Faust. For example, a new Faust unit generator (e.g., an audio DSP effect that takes an input from ChucK) can be declared as follow:

adc => Faust foo => dac;

In the case where foo would be a synthesizer, the adc would be ignored and we could simply write:

Faust foo => dac;

Any Faust program can be associated with foo and dynamically evaluated by calling the eval method.

foo.eval(`process=osc(440);`);

For brevity and convenience, stdfaust.lib is by default automatically imported by FaucK. Furthermore, note the use of the backtick (`) to delineate the inline Faust code - this removes the need to manually escape single and double quotation marks used in the Faust code.

Alternately, the same object can load a Faust program from the file system by invoking compile and providing a path to a Faust .dsp file:

foo.compile("osc.dsp");

Next, the v method can be called at anytime to change the value of a specific parameter defined on the Faust object that is specified by its path (v stands for "value"; we chose this abbreviation in anticipation that most programs will invoke this method often). For example, here we create a sine wave oscillator whose only parameter is its frequency (freq) and we set it to 440 Hz:

foo.eval(`
    frequency = nentry("freq",200,50,1000,0.01);
    process = osc(frequency);
`);
foo.v("freq",440);

Finally, the dump method can be called at any time to print a list of the parameters of the Faust object as well as their current value. This is useful to observe large Faust programs that have a large number of parameters in complex grouping paths. Programmers can also directly copy the path of any parameter to control for use with the v method.

Polyphony

Polyphony is supported. You simply need to provide DSP code that refers to correctly named parameters such as freq or note, gain, and gate. For more information, see the FAUST manual. For polyphony, you must set the number of voices to 1 or higher with the numVoices function. The default (0) disables polyphony. After setting the number of voices, evaluate the Faust code. Refer to examples/polyphony-simple.ck.

Full API

A Faust Chugin has the following functions:

Examples

Examples can be found in the examples folder of the FaucK distribution. You can debug why the Faust.chug may not be loading with chuck -v3 crybaby.ck or any other FaucK example.

Other Resources

Note to FaucK maintainers

If you need to update the version of Faust, you should update the Faust version number in the download scripts (thirdparty/libfaust/download*). Then you should make sure thirdparty/faust is checked out to that version tag.