A Cython wrapper of the Faust interpreter and signal processing library with RtAudio support.
Project description
cyfaust
The cyfaust project provides as a minimal, modular, self-contained, cross-platform cython wrapper of the Faust interpreter and the RtAudio cross-platform audio driver.
- Interpreter API: Fully wrapped with RtAudio cross-platform audio driver integration
- Box API: Fully wrapped with both functional and object-oriented interfaces
- Signal API: Fully wrapped with both functional and object-oriented interfaces
- Platform Support: macOS, Linux, and Windows
- Build Variants: Dynamic (
libfaust.so|dylib) and static (libfaust.a|lib) - Faust Version:
2.83.1
Installation
pip install cyfaust
Features
-
Python-oriented cross-platform implementation of the faust interpreter
-
Provides the following submodules (in the default build):
-
cyfaust.interp: wraps the faust interpreter and the rtaudio audio driver -
cyfaust.box: wraps the faust box api -
cyfaust.signal: wraps the faust signal api -
cyfaust.common: common utilities and classes
-
-
Self-contained, minimal, and modular design
-
Deliberately does not use LLVM to remove dependency on
libLLVM.[dylib|so]and keep size of python extension low (libLLVM14 is 94MB). -
Can generate code using the following backends:
- c++
- c
- rust
- codebox
-
Can generate auxiliary files such as svg block diagrams of dsp
-
Dual functional/oo design for box and signal apis with minimal code duplication.
-
Implements Memorviews for read/write buffer using
numpyorarray.array. -
Both dynamic and static build variants can be packaged as a self-contained python wheel.
-
Includes several github workflows to automate the testing and building of cyfaust wheels for a number of supported platforms
-
Command-line interface for common operations
Command-Line Interface
cyfaust provides a CLI accessible via the cyfaust command or python -m cyfaust:
cyfaust <command> [options]
# or: python -m cyfaust <command> [options]
Commands
version - Show cyfaust and libfaust version information:
cyfaust version
info - Display DSP metadata, inputs, outputs, and dependencies:
cyfaust info synth.dsp
compile - Compile Faust DSP to target backend (cpp, c, rust, codebox):
cyfaust compile synth.dsp -b cpp -o synth.cpp
cyfaust compile synth.dsp -b rust -o synth.rs
expand - Expand Faust DSP to self-contained code with all imports resolved:
cyfaust expand filter.dsp -o filter_expanded.dsp
cyfaust expand filter.dsp --sha-only # output only SHA1 key
diagram - Generate SVG block diagrams:
cyfaust diagram synth.dsp -o output_dir
play - Play a DSP file with RtAudio:
cyfaust play osc.dsp # play until Ctrl+C
cyfaust play osc.dsp -d 5 # play for 5 seconds
cyfaust play osc.dsp -r 48000 # use 48kHz sample rate
params - List all DSP parameters (sliders, buttons, etc.):
cyfaust params synth.dsp
validate - Check a DSP file for errors:
cyfaust validate filter.dsp
cyfaust validate filter.dsp --strict # treat warnings as errors
bitcode - Save/load compiled DSP as bitcode for faster loading:
cyfaust bitcode save synth.dsp -o synth.fbc
cyfaust bitcode load synth.fbc
json - Export DSP metadata as JSON:
cyfaust json instrument.dsp --pretty
cyfaust json instrument.dsp -o metadata.json
For detailed help on any command:
cyfaust <command> --help
Building
It has two build variants:
-
The default build is dynamically linked to
libfaust.dylib,libfaust.soorfaust.dlldepending on your platform and consists of a python package with multiple compiled submodules and embedded resources (faust libraries and architecture files):% tree -L 3 . └── cyfaust ├── __init__.py ├── box.cpython-311-darwin.so ├── common.cpython-311-darwin.so ├── interp.cpython-311-darwin.so ├── signal.cpython-311-darwin.so └── resources ├── architecture └── libraries
-
The static build is statically linked (with
libfaust.aorlibfaust.lib) and consists of a python package with a single compiled submodule and embedded resources (faust libraries and architecture files):% tree -L 3 . └── cyfaust ├── __init__.py ├── cyfaust.cpython-311-darwin.so └── resources ├── architecture └── libraries
While this project was initially developed and tested primarily on macOS (x86_64, arm64), Linux (amd64, aarch64) and Windows (amd64) are now supported in recent releases.
See the project's TODO for remaining enhancements.
Setup and Requirements
cyfaust has a build management script, scripts/manage.py, which simplifies cross-platform project setup and builds and also build automation in the case of github workflows.
usage: manage.py [-h] [-v] ...
cyfaust build manager
options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
subcommands:
valid subcommands
additional help
build build packages
clean clean detritus
setup setup prerequisites
test test modules
wheel build wheels
A brief guide to its use is provided in the following table:
| # | platform | step | command |
|---|---|---|---|
| 1* | common | install prerequisites | python3 scripts/manage.py setup --deps |
| 2 | common | build/install faustlib | python3 scripts/manage.py setup --faust |
| 3 | common | build cyfaust (dynamic) | python3 scripts/manage.py build |
| 4 | common | build cyfaust (static) | python3 scripts/manage.py build --static |
| 5 | common | test cyfaust | python3 scripts/manage.py test or pytest |
| 6 | common | build cyfaust wheels | python3 scripts/manage.py wheel --release |
| 7 | common | test cyfaust wheels | python3 scripts/manage.py wheel --test |
[*] Prerequisites consists of general and platform-specific requirements.
The general requirements are:
-
libfaustconfigured to be built with the c, c++, codebox, interp_comp, and rust backends and the executable, static and dynamic targets. -
libsndfileandlibsampleratefor faustsoundfileprimitive support
Platform specific requirements are covered in the next sections.
Windows
To build cyfaust you will need python to be installed (3.10+), a c++ compiler such as visual studio community edition and make sure to install c++ and Windows SDK development support, as well as git, and cmake.
Then do something like the following in a terminal:
git clone https://github.com/shakfu/cyfaust.git
cd cyfaust
pip install -r requirements.txt # or python3 scripts/manage.py setup --deps
python scripts/manage.py setup --faust
# then pick from 3, 4 or 6. For example
python scripts/manage.py build
pytest
# etc..
macOS & Linux
On macOS and Linux, a Makefile is available as a frontend to the above manage.py script to make it a little quicker to use.
The following setup sequence is illustrative of this and is also useful if you want to setup cyfaust manually.
For macOS, having Xcode or the CommandLine tools (xcode-select --install) installed is required, and then you will need to have python and cmake installed. If you use Homebrew, this is simply:
brew install python cmake
For Linux, if you are on a Debian-derived system, you will need something like the following:
sudo apt update
sudo apt install build-essential git cmake python3-dev # you probably have these already
sudo apt install libasound2-dev patchelf
Then
git clone https://github.com/shakfu/cyfaust.git
cd cyfaust
pip3 install -r requirements
make # or python3 scripts/manage.py setup --faust
-
This will download faust into the
builddirectory, then configure (and patch) it for an interpreter build, build it, and install it into the following (.gitignored) folders in the project directory:bin, containing the faust executables,lib, the dynamic and static versions oflibfaustandshare, the faust standard libs and examples.
-
Faust version
2.83.1will be used as it is a stable reference to work with and is used by the setup scripts. -
The script can be run again and will create (and overwrite) the corresponding files in the
bin,include,libandsharefolders.
To build the default dynamically-linked package and/or wheel:
make
or using uv (the project now uses scikit-build-core):
uv build --wheel
For a wheel:
make wheel
For the static variant, set the STATIC=1 environment variable with make, or use CMAKE_ARGS for direct builds:
make STATIC=1
or
CMAKE_ARGS="-DSTATIC=ON" uv build --wheel
To run the tests
make test
or
make pytest
Prior Art of Faust + Python
-
DawDreamer by David Braun: Digital Audio Workstation with Python; VST instruments/effects, parameter automation, FAUST, JAX, Warp Markers, and JUCE processors. Full-featured and well-maintained. Use this for actual work! (pybind11)
-
faust_python by Marc Joliet: A Python FAUST wrapper implemented using the CFFI (updated 2015). There's a more recent (updated in 2019) fork by Patrik Lechner. (cffi)
-
pyfaust by Alexandru Stan: Embed Faust DSP Programs in Python. (cffi)
-
faust-ctypes: a port of Marc Joliet's FaustPy from CFFI to Ctypes. (ctypes)
-
faustpp: A post-processor for faust, which enables more flexible code generation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cyfaust-0.1.0-cp314-cp314-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: cyfaust-0.1.0-cp314-cp314-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 7.7 MB
- Tags: CPython 3.14, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4015d14ee532ba83df99b63edc6fb9ca2f292acd67d31b82a9be20e3f55ad78e
|
|
| MD5 |
a71af0ad60ad8a8c9ac78b6ab3af23aa
|
|
| BLAKE2b-256 |
e078c6e432b42227c3791b8ac863b86321e3963d073dcd3edb2b56055d6a144e
|
File details
Details for the file cyfaust-0.1.0-cp314-cp314-macosx_15_0_arm64.whl.
File metadata
- Download URL: cyfaust-0.1.0-cp314-cp314-macosx_15_0_arm64.whl
- Upload date:
- Size: 6.4 MB
- Tags: CPython 3.14, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04ae45f0e12f5d13698e6b687d43ccd22a26dca41e997c5d8acdc29b4428afe8
|
|
| MD5 |
4a97c63eb0c2a66925cc681ff709b657
|
|
| BLAKE2b-256 |
0a4348da26c5f159b732edd77b887661e9702917f78302cd1142af56e26ffe2a
|
File details
Details for the file cyfaust-0.1.0-cp314-cp314-macosx_11_0_arm64.whl.
File metadata
- Download URL: cyfaust-0.1.0-cp314-cp314-macosx_11_0_arm64.whl
- Upload date:
- Size: 6.2 MB
- Tags: CPython 3.14, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8e69a766d257cb301721214d4a692c80aca224bbdef060284779220af432835
|
|
| MD5 |
9d80d6369f7a91b423e185d5fba6d760
|
|
| BLAKE2b-256 |
146ddb166589537a7ab3e47f930d772ef57fb1e38fdddde7aa72865ad849c021
|
File details
Details for the file cyfaust-0.1.0-cp313-cp313-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: cyfaust-0.1.0-cp313-cp313-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 7.7 MB
- Tags: CPython 3.13, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
870c6115f69016f60a24ad2409fb7df3187bf49e1d8e5fa19b9e32e66d8eb166
|
|
| MD5 |
d84af626428f9c2b2bd03869f2824aa8
|
|
| BLAKE2b-256 |
c479b9b258ccbd2a6559d8b1a23e0de5c890f995157076627fa32119c8a69d95
|
File details
Details for the file cyfaust-0.1.0-cp313-cp313-macosx_15_0_arm64.whl.
File metadata
- Download URL: cyfaust-0.1.0-cp313-cp313-macosx_15_0_arm64.whl
- Upload date:
- Size: 6.4 MB
- Tags: CPython 3.13, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff1677df6e6e244e1676ce3f493a101053f2d8eef1f6401b5ded2e17d2b5ed74
|
|
| MD5 |
c62ae080fb2b137a5c58e6555fe75223
|
|
| BLAKE2b-256 |
ee8540053ff5f41045a4689cc605b4293a5e7db11e5fea42b2cc20f6a432bab2
|
File details
Details for the file cyfaust-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: cyfaust-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 6.2 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8337a5098898252c00a605df874aab2008b31b27e67ea1a300fb716b3ba2db60
|
|
| MD5 |
cc3a9cd70fca3077cf4c59e8beb0f383
|
|
| BLAKE2b-256 |
75effca8e0efee635a981c64d066b927009c83d7a91df553d6a78cf559d04f64
|
File details
Details for the file cyfaust-0.1.0-cp312-cp312-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: cyfaust-0.1.0-cp312-cp312-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 7.7 MB
- Tags: CPython 3.12, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
785c0dc22546f12e3404dae2bc4885db51ad145581999c24aa189a68bfb97e2e
|
|
| MD5 |
4a06cbb06041197cf19fbfd3ac4a20e6
|
|
| BLAKE2b-256 |
d2048e39f7c824d2e8f03971dd6c192401a861ebc70665c97f84041b2a2ce93c
|
File details
Details for the file cyfaust-0.1.0-cp312-cp312-macosx_15_0_arm64.whl.
File metadata
- Download URL: cyfaust-0.1.0-cp312-cp312-macosx_15_0_arm64.whl
- Upload date:
- Size: 6.4 MB
- Tags: CPython 3.12, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
942c16ac35a5eca797b27e07e0b32b89b19529553126c31d04afb5db023aabcc
|
|
| MD5 |
d9ba47cf6474cee3328d24b31b36d886
|
|
| BLAKE2b-256 |
d4bd78dd3d273f3d2533075cbc5f6929ed094ac759936f050a54b3b5022b9c17
|
File details
Details for the file cyfaust-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: cyfaust-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 6.2 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d26470c01cf3c63a93eacca2e500dbecd25d5ee91ad8be3f7c89602bfbdc9968
|
|
| MD5 |
b90d5eedcd14b0548825b7ad7bfce1ea
|
|
| BLAKE2b-256 |
358c57813ab662acf0a3b79efe01d13f2df6aa099108594597a492366de66567
|
File details
Details for the file cyfaust-0.1.0-cp311-cp311-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: cyfaust-0.1.0-cp311-cp311-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 7.7 MB
- Tags: CPython 3.11, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
717281d8b746be063054e22a05c19175fdf3d97aa8d8800d2e6910163f031067
|
|
| MD5 |
90df453d35514ba299d575d970330b17
|
|
| BLAKE2b-256 |
b8e8ea39306ff65636fa89a4d7c4d99c59b0a9bcbcb4fe0cdfb2f15f5f3c2d8c
|
File details
Details for the file cyfaust-0.1.0-cp311-cp311-macosx_15_0_arm64.whl.
File metadata
- Download URL: cyfaust-0.1.0-cp311-cp311-macosx_15_0_arm64.whl
- Upload date:
- Size: 6.4 MB
- Tags: CPython 3.11, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dba1141c75da210c6b3570e6365232c85fa61b9f8e7767c5316b8ba3c14879c3
|
|
| MD5 |
abea299c2571ec58ab745688958d6f50
|
|
| BLAKE2b-256 |
08d8754321bf1df25d5ede362a697d0afbd10b88139059dd7fcfd172725a2451
|
File details
Details for the file cyfaust-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: cyfaust-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 6.2 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbd2d5286be42789ebefa21087d82ece350966822f56a02c1b9b6e7114409169
|
|
| MD5 |
9ec5ffed9a252afd463f2a26723fed9b
|
|
| BLAKE2b-256 |
b471b3860e1eb794a05140261314e2697ca5021fb42ddd1d99d4eaf73dcf3de7
|
File details
Details for the file cyfaust-0.1.0-cp310-cp310-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: cyfaust-0.1.0-cp310-cp310-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 7.7 MB
- Tags: CPython 3.10, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8625a428bd9cc0f887b0fe3059a4a857d0e6b43e3e778d712da22756c696a4d
|
|
| MD5 |
8d661b009e32f68fc40f98b5ca9e3de8
|
|
| BLAKE2b-256 |
e351f2c93f201277ebd7ac0e0818279bc34c0e580c91430dd15ef06cfd7b140f
|
File details
Details for the file cyfaust-0.1.0-cp310-cp310-macosx_15_0_arm64.whl.
File metadata
- Download URL: cyfaust-0.1.0-cp310-cp310-macosx_15_0_arm64.whl
- Upload date:
- Size: 6.4 MB
- Tags: CPython 3.10, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccde00c29fd2f659365583919c2be1fa94c640966eb130366481f69ef30ed22c
|
|
| MD5 |
b255acdfd7a3d06c08bc382e132bfa5c
|
|
| BLAKE2b-256 |
1747c17cabe39f10e5f571c382bbc4e9ba3ee1fef0dd44e568cb3571809f5385
|
File details
Details for the file cyfaust-0.1.0-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: cyfaust-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 6.2 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0df231e18c11cc7d1a688773b3b96feb2ed4890aad17442aa222c54d5417c6e
|
|
| MD5 |
962b3f1640af148b2eb2200fc41ee392
|
|
| BLAKE2b-256 |
74c033b76052d16e0638bcae33eb70d4b822a8e4558f96bebc561e229d04f193
|