Next  |  Prev  |  Up  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

Linux and Faust-Generated SuperCollider Plugins

The examples below were last fully tested on a Fedora 15 64-bit Linux system running FAUST version 0.9.43 (on 8/4/2011), and later updated based on email feedback in May of 2020. If anything else needs updating, please let me know via email.

The shell script faust2supercollider can be used to create a SuperCollider (SC) plugin from a FAUST source file:

  > faust2supercollider mysynth.dsp
The resulting class file mysynth.sc (the sclang ``extension'') and shared-object file mysynth.so (the scsynth or supernova ``plugin'') can be copied from the current working directory to your SC extensions directory, typically as follows on Linux systems:
  > mkdir -p ~/share/SuperCollider/Extensions/Faust/
  > cp mysynth.s[co] ~/share/SuperCollider/Extensions/Faust/.
Below we speak of using scsynth as the SuperCollider sound-synthesis server, but supernova, the more recent multithreaded generalization of scsynth, should also work in its place.

To try out the FAUST example osc.dsp, for example, first copy the generated files into your SC extensions directory:

  cp <faust>/examples/supercolliderdir/osc.s[co] ~/share/SuperCollider/Extensions/Faust
Next, restart sclang and scsynth,21 and execute the following code in sclang:
  y = {
      var out;
      out = {FaustOsc.ar(freq:100.0,volume:-40.0)}.dup;
    }.play(s)
You should hear a soft sinusoid at frequency 100 Hz. (Execute ``y.free;'' when you are tired of listening to it, which will likely be quite soon.)

The FaustOsc class in the file osc.sc created by the make is as follows:

  FaustOsc : UGen
  {
      *ar { | freq(1000.0), volume(0.0) |
          ^this.multiNew('audio', freq, volume)
      }
      *kr { | freq(1000.0), volume(0.0) |
          ^this.multiNew('control', freq, volume)
      }
      name { ^"osc" }
  }
We see for example that the default frequency and volume are $ 1$ kHz and 0 dB, respectively. Adapting a cool example from the SuperCollider Book, we can control the amplitude and frequency of the oscillator with the mouse as follows:
  z = {
      var out;
      out = (FaustOsc.ar(
            MouseX.kr(400,3000,\exponential), // freq (Hz)
            MouseY.kr(-90,10,\linear) // amp (dB)
            ) * MouseButton.kr).dup;  // gate = LEFT mouse button
      }.play(s);

  z.free;


Next  |  Prev  |  Up  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

Download aspf.pdf
[Comment on this page via email]

``Audio Signal Processing in Faust'', by Julius O. Smith III.
Copyright © 2021-04-07 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA