back

Faust with SuperNova

Faust is a programming language for DSP processing that creates C++ code for a variety of synth platforms, including SuperCollider.

SuperNova Is a multiprocessor aware version of the SuperCollider sound synthesis server scsynth.

There are a number of really, really good plugins for SuperCollider that are written in Faust. The most important one is arguably JPverb; Free Lexington-like reverb, anyone? More specifically, when I say "Really good", I mean "worth some effort to get running".

Which is exactly what was necessary. supernova simply says "JPverbRaw not installed" when using it, even though it's set up nicely. The only information I was able to find was a forum post from 2014 that said "no can do".

So after some probing, I found out two things:

(1) SuperNova insists on having a C extern called server_type, that is anything else than 0. (should probably be 1 for good measure)

(2) SuperNova assumes the SuperCollider UGen struct be called the same as the plugin name.

So here is a quick fix to apply to any Faust-Generated SuperCollider plugin source before compiling to make it work with supernova:

sed -i 's/\bFaust\b/PluginName\g' PluginName.cpp
echo "
#ifdef SUPERNOVA 
FAUST_EXPORT int server_type(void) { return sc_server_supernova; }
#else
FAUST_EXPORT int server_type(void) { return sc_server_scsynth; }
#endif
">> PluginName.cpp

So, for example, to compile JPverb, you would ordinarily do:

cd /path/to/src
git clone https://github.com/supercollider/sc3-plugins
cd sc-plugins
mkdir build
cd build
cmake -DSUPERNOVA=ON -dSC_PATH=/path/to/super/source/with/correct/version ..
make JPverb JPverb_supernova
sudo make install
sudo cp source/DEINDUGens/sc /usr/share/SuperCollider/Extensions/DEINDUGens

Using this with Supernova, it complains that JPverbRaw is not found. Faust appears to name the source file as the name we need, which is JPverbRaw.cpp. So we add the step above, and get these instructions:

cd /path/to/src
git clone https://github.com/supercollider/sc3-plugins
cd sc-plugins

# Here is the fix
sed -i 's/\bFaust\b/JPverbRaw/g' source/DEINDUGens/JPverbRaw.cpp
echo "
#ifdef SUPERNOVA 
FAUST_EXPORT int server_type(void) { return sc_server_supernova; }
#else
FAUST_EXPORT int server_type(void) { return sc_server_scsynth; }
#endif
">> source/DEINDUGens/JPverbRaw.cpp

mkdir build
cd build
cmake -DSUPERNOVA=ON -dSC_PATH=/path/to/super/source/with/correct/version ..
make JPverb JPverb_supernova
sudo make install
sudo cp source/DEINDUGens/sc /usr/share/SuperCollider/Extensions/DEINDUGens

So the next step would be to bring this rather dirty, manual approach and integrate it into Faust's supercollider.cpp architecture file, but that is for another day.