A FAUST wrapper-generator for ChucK Ugens
C++ C Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


faust2ck - A FAUST wrapper-generator for ChucK Ugens.

FAUST is a functional language for defining DSP structures that can be
used for real-time audio computing.  It can generate block diagrams
and also C++ code which will execute the given routine.

This is an ideal way to create unit generators (UGens) for ChucK.  The
ChucK data structures can be a bit weird and the learning curve for
hacking on ChucK can be a little steep.  Using FAUST, you can
concentrate on the DSP algorithm, and allow faust2ck to take care of
creating ChucK-compatible C++ code so that you can instantiate your
new DSP object in a ChucK program.

Please see the FAUST websites for more details, online tutorials, and
even an online compiler that you can try:


This document describes how to use faust2ck.

This code is directly based off of Scott Sinclair's original faust2ck, 
without which this latest iteration would not exist:


To build faust2ck, first download the source:

$ git clone https://github.com/spencersalazar/faust2ck.git

Then compile:

$ cd faust2ck/src
$ make

Then install!

$ sudo make install


Running faust2ck with no parameters will give you a usage string:

$ faust2ck 
Usage: faust2ck <filename.dsp>

You can see that it requires a single input, the name of a FAUST .dsp file.
How you come up with this .dsp file is beyond the scope of this document, 
but check out here: http://faust.grame.fr/examples.html for some 
cool examples.

When you execute faust2ck with a suitable .dsp file:

$ faust2ck filename.dsp

it will generate a ChuGin called "filename.chug". You can load this into ChucK
with the -g option:

$ chuck -gfilename

but chuck will exit immediately because you haven't provided it with a script
to run. If you want to load your new ChuGin without the annoying -g option, 
simply copy it to your ChuGin directory (typically /usr/local/lib/chuck). 


This code is licensed under the GNU General Public License (GPL) v2 or
above.  Please see COPYING for details, or visit:



You wrote a string parsing and XML reading program
like this, in 2008, in C ???!  Are you mad?

Yes, a sane person would probably not do such a thing.  The FAUST XML
output is so simple, however, and generally predictable, that I didn't
feel it was necessary to bring in a lot of external dependencies for
such a small application.  So I ended up basically writing a small,
inadequate macro replacement parser, which was actually kind of fun.
Of course, if it ever called for more a complex solution I'd probably
re-do it in Perl or Python.  But this'll do for now, and it means the
program is tiny and easy to execute on any computer without installing
huge libraries.

Of course, it does depend on 'sed' to generate the template for
inclusion in the final program.  I wanted to include it right in the
executable instead of having faust2ck load an external file that would
always be exactly the same.  Unfortunately the C preprocessor doesn't
make it easy, so sed is just used to wrap lines of the template file
in double-quotes ("") and backslash-escape a few special characters.

faust2ck is distributed with the template already generated so that it
can be compiled without needing to have sed around.