TD-Faust is an integration of FAUST (Functional AUdio STream) and TouchDesigner. The latest builds are for TouchDesigner 2023.11290 and newer. Older TD-Faust builds can be found in the Releases.
Demo / Tutorial:
Examples of projects made with TD-Faust can be found here. Contributions are welcome!
Visit TD-Faust's Releases page. Download and unzip the latest Windows version. Copy TD-Faust.dll
and the faustlibraries
folder to this repository's Plugins
folder. Open TD-Faust.toe
and compile a few examples.
If you need to compile TD-Faust.dll
yourself, you should first install Python 3.11 to C:/Python311/
and confirm it's in your system PATH. You'll also need Visual Studio 2022 and CMake. Then open a "x64 Native Tools for Visual Studio" command prompt with Administrator privileges to this repo's root directory and run python build_tdfaust.py
.
Visit TD-Faust's Releases page. Download and unzip the latest macOS version. Users with "Apple Silicon" computers should download "arm64". Copy TD-Faust.plugin
and Reverb.plugin
to this repository's Plugins
folder.
Open TD-Faust.toe
and compile a few examples.
git submodule update --init --recursive
cmake --version
in Terminal. You may need to run export PATH="/Applications/CMake.app/Contents/bin":"$PATH"
brew install autoconf autogen automake flac libogg libtool libvorbis opus mpg123 pkg-config
python3 build_tdfaust.py --pythonver=3.11
TD-Faust.toe
We have previously described a multi-purpose CHOP that dynamically compiles Faust code inside TouchDesigner. Although it's powerful, you have to specify the DSP code, press the compile
parameter, and only then do the CHOP's parameters appear. In contrast, ordinary CHOPs can be created from the OP Create Dialog and already have parameters, but they are narrower in purpose. What if you want to use Faust to create a more single-purpose Reverb CHOP with these advantages? In this case, you should use the faust2touchdesigner.py
script.
These are the requirements:
reverb.dsp
that defines a process = ...;
.If on Windows, you should open an "x64 Native Tools for Visual Studio" command prompt. On macOS, you can use Terminal. Then run a variation of the following script:
python faust2td.py --dsp reverb.dsp --type "Reverb" --label "Reverb" --icon "Rev" --author "David Braun" --email "github.com/DBraun" --drop-prefix
Limitations and Gotchas:
python3
on macOS.Faust_Reverb_CHOP.h
, Faust_Reverb_CHOP.cpp
, and Reverb.h
, so avoid changing those files later.soundfile
primitive has not been implemented (waveform
is ok!)si.smoo
after each hslider
/vslider
.You don't need to import("stdfaust.lib");
in the FAUST dsp code. This line is automatically added for convenience.
gate
, gain
, and freq
when writing the DSP code..lib
files).wav
files.Compile
is pulsed.The Faust CHOP's Python interface is similar to the Audio VST CHOP.
sendNoteOn(channel: int, note: int, velocity: int, noteOffDelay: float=None, noteOffVelocity: int=None) -> None
(noteOffDelay
and noteOffVelocity
aren't used yet)sendNoteOff(channel: int, note: int, velocity: int) -> None
panic() -> None
sendAllNotesOff(channel: int) -> None
sendControl(channel: int, ctrl: int, value: int) -> None
sendPitchBend(channel: int, wheel: int) -> None
sendProgram(channel: int, pgm: int) -> None
One great feature of TD-Faust is that user interfaces that appear in the Faust code become Custom Parameters on the Faust Base. If a Viewer COMP is set, then it can be automatically filled in with widgets with binding. Look at the simple Faust code below:
import("stdfaust.lib");
freq = hslider("Freq", 440, 0, 20000, 0) : si.smoo;
gain = hslider("Volume[unit:dB]", -12, -80, 20, 0) : si.smoo : ba.db2linear;
process = freq : os.osc : _*gain <: si.bus(2);
If you compile this with a Faust Base, the Base will create a "Control" page of custom parameters. Because of the code we've written, there will be two Float parameters named "Freq" and "Volume". In order to automatically create a UI, pressing compile will save a JSON file inside a directory called dsp_output
. These files are meant to be temporary and are deleted each time TD-Faust.toe
opens.
The Group Voices
and Dynamic Voices
toggles matter when using polyphony.
If you enable Group Voices
, one set of parameters will control all voices at once. Otherwise, you will need to address a set of parameters for each voice.
If you enable Dynamic Voices
, then voices whose notes have been released will be dynamically turned off in order to save computation. Dynamic Voices should be on in most cases such as when you're wiring a MIDI buffer as the third input to the Faust CHOP. There is a special case in which you might want Dynamic Voices
off:
Group Voices
is off.The sample rate is typically a high number such as 44100 Hz, and the control rate of UI parameters might be only 60 Hz. This can lead to artifacts. Suppose we are listening to a 44.1 kHz signal, but we are multiplying it by a 60 Hz "control" signal such as a TouchDesigner parameter meant to control the volume.
import("stdfaust.lib");
volume = hslider("Volume", 1., 0., 1., 0);
process = os.osc(440.)*volume <: si.bus(2);
In TouchDesigner, we can press "Compile" to get a "Volume" custom parameter on the "Control" page of the Faust base. You can look inside the base to see how the custom parameter is wired into the Faust CHOP. By default, this "Volume" signal will only be the project cook rate (60 Hz). Therefore, as you change the volume, you will hear artifacts in the output. To reduce artifacts, there are three solutions:
Use si.smoo or si.smooth to smooth the control signal: volume = hslider("Volume", 1., 0., 1., 0) : si.smoo;
Create a higher sample-rate control signal, possibly as high as the Faust CHOP, and connect it as the second input to the Faust base.
Re-design your code so that high-rate custom parameters are actually input signals.
import("stdfaust.lib");
// "volume" is now an input signal
process = _ * os.osc(440.) <: si.bus(2);
You could then connect a high-rate single-channel "volume" CHOP to the first input of the Faust Base.
From this repository, copy the toxes/FAUST
structure into your new project. You should have:
MyProject/MyProject.toe
MyProject/toxes/FAUST/FAUST.tox
and any other files which are sibling to FAUST.tox
Now drag FAUST.tox
into your new TouchDesigner project, probably near the root. FAUST.tox
acts as a Global OP Shortcut. Next, copy toxes/FAUST/main_faust_base.tox
into the project and use it in a way similar to how it's used in TD-Faust.toe
.
TD-Faust (GPL-Licensed) relies on these projects/softwares: