Custom Sporth ugens with faust using faust2sporth

Somewhat recently, I made it possible to load custom Sporth ugens through a sporth plugin format. This advancement in Sporth lead to the development of faust2sporth, a utility that generates sporth plugins from Faust code.

Motivation

faust2sporth was created for the following reasons:

Installation

faust2sporth currently can be found in the Sporth codebase in the folder util/faust2sporth. The two files needed are the architecture file (sporth.cpp) and shell script (faust2sporth). On Linux, you could copy faust2sporth in a place like /usr/local/bin and the architecture file in a place like /usr/local/lib/faust.

Usage

Here is some simple Faust code, using an off-the-shelf cubic non-linear distortion generator put through a dcblocker:

 import("effect.lib");
 drive = hslider("[0]drive", 0, 0, 1, 0.0001);
 offset = hslider("[1]offset", 0, 0, 4, 0.0001);
 process = cubicnl(drive, offset) : dcblocker;

Like any faust2 utility, this can be compiled in the following way:

 faust2sporth dist.dsp

Which will create a file called "dist.so". This plugin can be loaded and executed in Sporth in the following way:

 'dist' './dist.so' fl
 # load an audio file
 'oneart.wav' diskin
 # Drive 
 3.0 
 # Offset
 0.5 
 'dist' fe
 'dist' fc