Forums > MaxMSP

faustgen~ : LLVM powered Faust embedded compiler as an external for Max/MSP

November 16, 2012 | 4:45 pm

Thanks to the awesome LLVM technology ( combined with "libfaust", the new library version of the Faust compiler, Faust DSP programs can now directly be compiled and executed on the fly at full speed. The Faust DSP source, compiled by libfaust using the LLVM backend, produces an intermediate representation (as LLVM IR :, to be compiled and executed as native machine code directly in memory (using LLVM JIT technology). The LLVM IR can itself be optimized (using "optimization passes" in LLVM terminology), and the JIT component can be configurated to produce the best possibly native machine code.

This compilation chain has been experimented in faustgen~, an external for Max/MSP. Faustgen~ allows to easily use Faust source code inside a Max/MSP patcher, edit it, change compilation options, and even produce the processor flow chart as an SVG diagram. Preliminary tests show that the resulting native code runs at speed comparable to what the previous static compilation model was achieving.

A package containing the faustgen~external as well as faustgen~.maxhelp file, can be downloaded on the Faust site here:

November 16, 2012 | 8:24 pm

as far as i am concerned, this is a major moment in computer dsp processing, let alone in max. as big as gen~. congratulations. i’d heard this was on the cards, and quite awesome it has appeared so quickly. i’ll be getting stuck in as soon as possible. thanks.

November 16, 2012 | 9:56 pm

Indeed. I knew this was coming, but that fast !…

November 16, 2012 | 11:37 pm

great stuff! but obviously OsX only :-(
can we expect a Windows version?

November 17, 2012 | 7:20 am

Concerning Windows version, we had problems with "dynamic" inlets/outlets (the faustgen~ object has to change the number of ins/outs when the DSP source is changed). This was just crashing on Windows when we tried.

November 17, 2012 | 8:46 am

thanks for the info sletz.
couldn’t this bug be addressed by cycling74 ?
Could be a Max6 bug related to windows only?

November 17, 2012 | 11:06 am

very cool. I notice that when I double click a faustgen~ object the menu always seems to appear in the same place on the screen, far from my cursor. Could I suggest a usability improvement? I think that double click should just opens the "DSP code" text editor, which is how other max objects with text editors work. The other options are probably used less and could be accessed by sending messages to the object.

November 20, 2012 | 9:56 am

hi sletz.
could be a bug solving problem for cycling74?
i think that dynamic changing of inlets and outlets seems a problem for Max ( if it works on Mac should work on Windows to i guess? )

November 20, 2012 | 10:16 am

Cycling74 (thanks for them!) send us some code that should work on Windows also.

November 20, 2012 | 11:30 am

thanks sletz and cycling74 !
i’ll patiently wait for a win release to test!

November 20, 2012 | 2:34 pm

Go Stéphane, go! (Stéphane is the brains behind Jack on OS X and Windows, FYI).

Great work. The Faust stuff is really cool, and having it available directly within Max is a big win. Will check it out ASAP!

November 20, 2012 | 5:12 pm
November 20, 2012 | 5:35 pm

thanks sletz!
is the new version compiled for Windows to ?

November 20, 2012 | 6:04 pm

is there such thing as a changelog ?

November 20, 2012 | 9:54 pm

file ‘Install faustgen~.rtf’ inside the folder.


November 20, 2012 | 10:55 pm

obviously. i was stupid. thanks

November 26, 2012 | 11:43 am

hi stephane!
any progress on a windows version for faustgen~?
thanks and all the best

November 27, 2012 | 10:20 pm

Windows version for faustgen~ : in progress…

November 27, 2012 | 11:46 pm

great! thanks stephane for the info.

December 3, 2012 | 5:11 pm

Version 0.81b available with faustgen~ for Windows. Please test and report.

December 3, 2012 | 6:59 pm

Stéphane se développe à pas de loup, et nous en musique assistée par ordinateur sont tous profondément dans sa dette!

Merci, Stéphane.

December 3, 2012 | 11:47 pm

great ! thanks Stephane! did a quick test. everything seems to work except opening the block diagram file. do we need to have othe faust stuff for it to be open. When i try i have a kindo of "program not found " error. in a couple of days i’ll run more detailed tests.

December 4, 2012 | 7:43 am

Opening SVG (dynamically generated) or PDF (documentation) or even text files (for Faust libraries), is currently done by launching a command to open the given file. It means an application has to be associated with the file. SVG files are supposed to be displayed by a browser (like Firefox, Chrome….)

December 4, 2012 | 10:10 am

i’ll try to do the file association manually. but i suspect that the shell command given by the faustgen~ external is not correct. i’ll do a test in a couple of hours and report back right away. thanks for info stephane!

December 4, 2012 | 11:35 am

Here is the kind of command that is done: "start /b file:///E:/faustgen-111-svg/process.svg"

Please report if you know a better/safer way to do.

December 4, 2012 | 1:12 pm

hi stephane,
these are the error that i have trying to open the SVG and the PDF files from doubleclicking on faustgen~.
I have the same error as the PDF one while trying to view libraries. But the error is repeated several times.

[attachment=209735,4716] [attachment=209735,4717]

  1. pdferror.png


December 4, 2012 | 2:33 pm

Well, those look suspisiously like the "Spaces in path passed to unix style commandline" error. Since the default win path to Cycling74 is in C:Program Files ( with a space), perhaps a whitespace escape should be applied to path before sending it to commandline call?

just guessin’… if that’s it, oh, those win/*nix differences…how annoying.


December 4, 2012 | 3:24 pm

1) Have you correctly copied the "faustgen-resources" folder along with the faustgen~.mxe object? (as explained in the "Install faustgen~.rtf" file)

2) SVG files (actually inside a folder) will be dynamically generated in this "faustgen-resources" folder : can you see them?

December 4, 2012 | 4:14 pm

"Stéphane se développe à pas de loup, et nous en musique assistée par ordinateur sont tous profondément dans sa dette!"

Hum the (automatic ??) french translation smells like "poetry" ((-; what was the original sentence?

December 4, 2012 | 8:59 pm

"à pas de loup" = "with wolf’s steps"…a phrase my ancient parisian french teacher taught some 35+ years ago, with the implied meaning of great rapidity, of a almost scary sort….soooo….. "Stephane develops at a remarkably speedy pace, and all of us in the computer music community are deeply in his debt."
just trying to be supportive in a grandiose , perhaps even amusing way…

*clunk*, …hmmm…k, ‘nother lose…:,-(…

good work, keep it up, Stephane…

December 4, 2012 | 11:31 pm

Hi Stephane,
yes i do have the faustgen-resources folder in the msp-externals one.
Since i am on Windows 7 64 bit the default location of my Max 6.0.8 install is
C:Program Files (x86)Cycling ’74Max 6.0
so the faustgen-resource folder is
C:Program Files (x86)Cycling ’74Max 6.0Cycling ’74msp-externalsfaustgen-resources

when i try to view the svg files i get the error but two folders are created containing the svg files that i can actually open with Chrome.

December 5, 2012 | 12:37 pm
December 5, 2012 | 1:11 pm

thanks stephane!
now svg and pdf works perfectly.
what’s in the .lib files and with wich app is good to open those ?

December 5, 2012 | 1:15 pm

The ".lib" are the Faust libraries: those are simply text files.

December 5, 2012 | 1:20 pm

are those supposed to be open the same way we open the code to be edited with "Edit DSP code" ?

December 5, 2012 | 1:28 pm

i mean….wouldn’t be nice to have another line similar to "max fileformat .dsp TEXT 0 "Faust DSP language file" dspfile;" for the .lib files to be open ?

December 5, 2012 | 1:31 pm

nahh.. ’cause they aren’t not to be edited…sorry for the stupid things i said above :-)

December 5, 2012 | 1:36 pm

a question about the web-compiler.
Stephane, do you think we can have SuperCollider Ugen and Csound opcode compilation on Windows ?

December 5, 2012 | 1:46 pm

And since my curiosity is piqued: those strangely truncated paths in the error popups? Symptom of path string issue, or something else? ( I only ask since debugging other developer’s code is my major daily activity…at least recently, :) ). And RE: "on tiptoe": this explains why my memory of the meaning of the phrase involving fear…the 15y.o. Charlie was deeply impressed with the large number of odd phrases she (my ancient teacher,the only formal contact w/ the language I ever had ) used involving the wolf as metaphor…which is why I tried to use the expression: it seemed the ‘most fun’ of the idiomatic translations I looked up, and I recalled her treasure trove of wolf idioms: they seemed so strange and interesting at the time. thanks again for your "awesome" coding efforts!

December 5, 2012 | 2:44 pm

1) We know use coding like : start "" "file:///E:/faustgen-111-svg/process.svg" (because start command requite a "title")

2) "do you think we can have SuperCollider Ugen and Csound opcode compilation on Windows ?" ==> possibly at on point in the future..

December 5, 2012 | 3:33 pm

thanks Stephane.
I see in the quick start .pdf that at page 47 table 5.2 reports SC Ugens and Csound opcodes as available audio architecture on Windows.
So are they implemented in Faust ( i.e. FaustWorks ) but not in the online compiler ?
many thanks for your great coding effort and infos!

January 4, 2013 | 4:09 pm

We are happy to announce the first distribution of Max/MSP oriented FAUST examples, by Christophe Lebreton, © GRAME

Get them here : file at

March 11, 2013 | 11:20 pm

New 0.83b version at

– 09/03/2013 : Version 0.83b : add "write" message to save DSP in external files
– possibly fix for LLVM related bugs

March 15, 2013 | 10:15 am

New 0.84b version at

15/03/2013 : Version 0.84b : crashing bug correction in LLVM code generation

March 15, 2013 | 2:20 pm

hi stephane,
on sourceforge there is still the 0.83b version. and no 0.84b.
thanks for your great work!

March 15, 2013 | 2:52 pm

New 0.85b version at

15/03/2013 : Version 0.85b : memory management corrections in LLVM code generation

(still 32 bits only for now… version 64/32bits to be used with latest Max/MSP 6.1 in test)

March 15, 2013 | 3:18 pm


April 5, 2013 | 5:05 pm

New 0.86b version at

– 04/05/2013 : Version 0.86b : fix recursion limitation bug in Faust

(still 32 bits only for now… version 64/32bits to be used with latest Max/MSP 6.1 in test)

April 17, 2013 | 1:59 pm

great ! this faust language is so powerful !

I have a question… is it possible to dynamically change the number of processors in the resonator example ? like with the CNMAT resonator ?
it would be very nice, or at least being able to selectively mute some processors…
thank you.

May 6, 2013 | 1:15 pm

New 0.87b version at

– 06/05/2013 : memory management correction in Faust. New "write" message to save DSP files. 64/32 bits version on OSX.

November 6, 2013 | 12:47 pm

Does anyone know whether faustgen~ works with Max4Live? Does it need gen~? Cheers!

November 6, 2013 | 12:56 pm

Nevermind. The answers are "yes, it does work in Max4Live" (I had to restart a couple times before it would show up), "No, it does not require gen~" :)

November 7, 2013 | 1:46 am

Hi. I’m a bit confused about the *.lib files. There is a subfolder in the Windows installation folder which contains a few, but no mention in the installation instructions. I’m on a mac and the "imports" don’t seem to be complaining about their absence. Are they embedded in the faustgen mxo file?

I’m trying to add one from the stk-faust lib. Does it just need to go in the PATH somewhere?


November 7, 2013 | 3:20 am

Also is there a reference anywhere for those included libs?

November 8, 2013 | 8:50 am

On OSX, Faust libraries files are located in the mxo file, in Contents/Resources folder. You can possibly add you own files here. We’ll probably improve the libraries files location system in a future version.

November 8, 2013 | 10:53 am

Thanks. I ended up adding the stk port in an "stk/" subfolder. Then I can just simple do import("stk/instrument.lib") etc…

Many thanks for this @sletz. It is awesome…I’m so excited! Working on a synthesiser version of my iOS app ( and this will help things considerably…

November 25, 2013 | 7:50 am

I’m having some trouble with inputs into faustgen. It seems that sliders/flonums/live.dial’s messaged to input parameters aren’t translating correctly. Even the with faustgen help file, with the "gain" example, as you scroll through values, it seems to toggle gain between 0 and 1 judging by the meter. If you type entries in manually some map to 1 and others to 0. Has anyone else experienced this?

December 6, 2013 | 4:57 pm


First off, great external, a good entryway to faust.

Second, I’m also trying to use the faust-stk, like Harikaram. I’ve put the instrument.lib in Contents/Resources, but am running into a problem. faustgen~ crashes Max everytime I try to load a function which relies on the ffunction() call, such as modalBar.dsp.

Max: "read modalbar.dsp"
program crashes
console log reads

12/6/13 4:45:14 PM Max[3100] Max: db update complete
12/6/13 4:46:33 PM [0x0-0x72072].com.cycling74.Max[3100] LLVM ERROR: Program used external function ‘readMarmstk1’ which could not be resolved!
12/6/13 4:46:33 PM [0x0-0x72072].com.cycling74.Max[3100] StartNotification name = default
12/6/13 4:46:33 PM[118] ([0x0-0x72072].com.cycling74.Max[3100]) Exited with exit code: 1

call from instrument.lib is:
"readMarmstk1 = ffunction(float readMarmstk1 (int), ,"");"

and "readMarmstk1" is a cpp function in instrument.h which I’ve added to the same folder.

Any idea why this isn’t working?

January 20, 2014 | 5:45 am

Yes, linking to code defined in external .h or .c or .cpp files is not currently supported. This would require faustgen~ to "embed" the entire C/C++ ==> LLVM IR ==> executable machine code compilation chain. Note that supporting arbitrary C/C++ code compilation could indeed become rapidly tricky. In the case of STK instruments, C headers files are currently used to access parameters tables. This may be doable directly in Faust with the new "waveform" syntax that now allows to define data tables directly in the .dsp source. We’ll have to update faustgen~ to use this new "waveform" syntax.

April 18, 2014 | 4:02 pm

How are you supposed to get the samplerate inside faustgen? if i use the SR constant it is wrong (allways 44100)

September 7, 2014 | 5:04 pm


Thanks for all of your help on this wonderful project. I can tell that you put in a lot of hard work, and it works like a charm in OS X!

One of my students would like to use faustgen~ with Windows, so I’m trying to figure out what the situation is. It seems that the faustgen v0.87 archive only contains a 32-bit version, so I went back and installed the 32-bit version of Max 6.1.8 for Windows. Then I was able to instantiate the faustgen~ object. However, when I don’t think that it’s finding the lib files. I get the error "Unable to open file math.lib" when I try to compile a simple DSP file using it.

I tried having the lib files in the same directory as the currently open patch, adding the directory of lib files to the Max path, and directly putting them inside the msp-externals directory. Still it doesn’t find the lib files.


PS. Also there is the error "Cannot read "version" key, so ignore bitcode, force recompilation and use default compileoptions.

January 19, 2015 | 2:20 pm

@Edgar I’m on a mac but I had to place them inside of the faustgen~.mxo "package" (an app on a mac is usually a folder which looks like a file until you choose "Show package contents"). I’m not sure how it’s structured on the PC but basically I’d guess you need them in the same path as the faustgen~ executable.

October 18, 2015 | 2:43 pm
Viewing 63 posts - 1 through 63 (of 63 total)

Forums > MaxMSP