Skip to content
Albert Graef edited this page Aug 6, 2022 · 7 revisions

Using Pure with Faust

Yann Orlarey's Faust is a functional programming language for real-time sound processing and synthesis developed at Grame and distributed as GPL'ed software. With Faust you can develop signal processing algorithms in a high-level functional language, but still achieve a performance comparable to carefully handcrafted C routines.

Pure provides tight integration with Faust through its built-in Faust interface which can be used both to inline Faust code in Pure scripts and to load external Faust modules in LLVM bitcode format dynamically at runtime.

There's also a separate pure-faust addon module which can be used either with the built-in Faust interface or with external Faust modules available in shared library format.

Getting Faust

To work with Faust you'll need a Faust installation, of course. You basically have the following options there:

  • Use the mainline Faust compiler, available on Github. This is required to build Faust modules for an abundance of different target environments, including Pure, and to utilize Pure's built-in Faust interface and Faust inlining capabilities.
  • Use FaustLive, Grame's stand-alone graphical frontend to the Faust compiler, which doesn't need any external compiler toolchain and lets you compile and run Faust dsps on the fly.
  • Use Grame's online compiler or the Faust IDE, which both allow you to create the source code of a Faust dsp, compile it to an abundance of different targets, and download the compiled dsp to your machine.
  • Use the Faust playground, a graphical editor which lets you create Faust programs, runs them right in your web browser, and supports the same export targets as the online compiler.

While the other options provide awesome environments for rapid prototyping and creating plugins for various targets, only the mainline Faust compiler currently has the capability to produce Pure modules, so that's the one that you should get and install on your system.

Faust Version

Pretty much any Faust version >= 0.9.67 will do the job. Use either the pure.cpp or the pure.c architecture to create a shared module (dll on Windows) which can then be loaded in Pure using the pure-faust add-on module.

However, to utilize Pure's internal Faust interface, which allows the inlining of Faust code in Pure scripts and the loading of Faust LLVM bitcode files, you'll need a Faust version which is linked against the same LLVM version that Pure uses, which means LLVM version 3.5 at this time. The last version of Faust which still works with LLVM 3.5 is somewhere around the (unreleased) 2.11.14 version, for which packages are available, see below.

Faust Packages and Ports

At the time of this writing, the following ready-made packages and ports for Linux, Mac OS X and Windows are available.

NOTES:

  • The Pure package in MacPorts is linked against LLVM 3.4 rather than LLVM 3.5, because LLVM 3.5 doesn't work all that great on some macOS versions.
    • The faust package is currently at 2.5.23, the faust-devel package at 2.11.14.
  • None of these are linked against LLVM 3.4 by default, but you can download the faust-devel port from Github and change the Portfile to enforce compilation with LLVM 3.4. This should still work even on the latest macOS versions. TODO: Provide a ready-made Portfile for that configuration.
Clone this wiki locally