FAUST (programming language)
{{Short description|Audio programming language}}
{{redirect|FAUST|other uses|Faust (disambiguation){{!}}Faust}}
{{More footnotes needed|date=March 2015}}
{{Infobox software
| name = FAUST
| developer = GRAME, Centre National de Création Musicale
| author = Yann Orlarey, Dominique Fober, Stéphane Letz
| released = {{start date|2002}}
| latest release version = 2.60.3[https://github.com/grame-cncm/faust/releases Releases · grame-cncm/faust · GitHub]
| latest release date = {{start date|2023|06|14}}
| operating system = Linux, OS X, Windows, Unix
| genre = Functional programming language for audio signal processing
| programming language = C++
| license = GPL
| website = {{URL|faust.grame.fr}}
}}
FAUST (Functional AUdio STream) is a domain-specific purely functional programming language for implementing signal processing algorithms in the form of libraries, audio plug-ins, or standalone applications. A FAUST program denotes a signal processor: a mathematical function that is applied to some input signal and then fed out.
Overview
The FAUST programming model combines a functional programming approach with a block diagram syntax:
- The functional programming approach provides a natural framework for signal processing. Digital signals are modeled as discrete functions of time, signal processors as second order functions that operate on them, and FAUST's block diagram composition operators, used to combine signal processors together, as third order functions, etc.
- Block diagrams, even if purely textual as in FAUST, promote a modular approach to signal processing that complies with sound engineers' and audio developers' habits.
A FAUST program doesn't describe a sound or a group of sounds, but a signal processor. The program source is organized as a set of definitions with at least the definition of the keyword process
(the equivalent of main
in C):
process = ...;
The FAUST compiler translates FAUST code into a C++ object, which may then interface with other C++ code to produce a full program.
The generated code works at the sample level. It is therefore suited to implement low-level DSP functions like recursive filters. The code may also be embedded. It is self-contained and does not depend on any DSP library or runtime system. It has a very deterministic behavior and a constant memory size.
The semantics of FAUST is driven to be simple and well-defined. It allows the FAUST compiler to be semantically driven. Instead of compiling a program literally, it compiles the mathematical function it denotes. This may promote component reuse. Moreover, having access to the exact semantics of a FAUST program can simplify preservation issues.
FAUST is a textual language but block diagram oriented. It combines two approaches: functional programming and algebraic block diagrams, which are constructed via function composition. For that, FAUST relies on a block diagram algebra of five composition operations.
Example code
FAUST programs define a process
function that operates on incoming data. This is analogous to the main
function in most programming languages. The following is an example that produces silence:
process = 0;
The second example copies the input signal to the output. It involves the _
primitive that denotes the identity function for signals:
process = _;
Another example sums a stereo signal into a mono signal using the +
primitive:
process = +;
File:Faust-simple-block-diagram.jpg
Most FAUST primitives are analogous to their C counterpart on numbers, but lifted to signals. For example, the FAUST primitive sin
operates on a signal X by applying the C function sin
to each sample X[t]. All C numerical functions have their counterpart in FAUST.
Some signal processing primitives are specific to FAUST. For example, the delay operator @
takes two input signals: X (the signal to be delayed) and D (the delay to be applied), and produces an output signal Y such that Y(t) = X(t − D(t)).
Block diagram composition
Contrary to Max-like visual programming languages where the user does manual connections, FAUST primitives are assembled in block diagrams by using a set of high-level block diagram composition operations.
File:Faust-simple-block-diagrams.jpg
class="wikitable"
|+ The block diagram composition operators used in FAUST | f~g | Recursive composition (precedence 4) |
f,g | Parallel composition (precedence 3) |
f:g | Sequential composition (precedence 2) |
f<:g | Split composition (precedence 1) |
f:>g | Merge composition (precedence 1) |
Using the sequential composition operator :
the output of +
can be routed to the input of abs
to compute the absolute value of the signal:
process = + : abs;
Here is an example of parallel composition using the ,
operator that arranges its left and right expressions in parallel. This is analogous to a stereo cable.
process = _,_;
These operators can be combined arbitrarily. The following code multiplies an input signal with 0.5:
process = _,0.5 : *;
The above may be rewritten in curried form:
process = *(0.5);
The recursive composition operator ~
can be used to create block diagrams with cycles (that include an implicit one-sample delay). Here is an example of an integrator that takes an input signal X and computes an output signal Y such that Y(t) = X(t) + Y(t−1):
process = + ~ _;
Generating full applications
Using specific architecture files, a FAUST program can be used to produce code for a variety of platforms and plug-in formats. These architecture files act as wrappers and describe the interactions with the host audio and GUI system. {{As of|2021}}, more than 30 architectures are supported and new ones may be implemented by anyone.
class="wikitable"
|+ Some architecture files available for FAUST | alsa-gtk.cpp | ALSA application + GTK |
alsa-qt.cpp | ALSA application + QT4 |
android.cpp | Android applications |
au.cpp | Audio Unit plug-in |
ca-qt.cpp | CoreAudio application + QT4 |
ios-coreaudio.cpp | iPhone and iPad applications |
jack-gtk.cpp | JACK application + GTK |
jack-qt.cpp | JACK application + QT4 |
ladspa.cpp | LADSPA plug-in |
max-msp.cpp | Max MSP plug-in |
pd.cpp | Puredata plug-in |
q.cpp | Q language plug-in |
supercollider.cpp | Supercollider plug-in |
vst.cpp | VST plug-in |
vsti-mono.cpp | Monophonic VST Instrument plug-in |
vsti-poly.cpp | Polyphonic VST Instrument plug-in |
Generating block diagrams
A useful option makes it possible to generate the block diagram representation of the program as one or more SVG graphic files.
It is useful to note the difference between the block diagram and the generated C++ code. As stated, the key idea here is not to compile the block diagram literally, but the mathematical function it denotes. Modern C/C++ compilers also don't compile programs literally. But because of the complex semantics of C/C++ (due to side effects, pointer aliasing, etc.) they can't go very far in that direction. This is a distinct advantage of a purely functional language: it allows compilers to do very advanced optimisations.
Arrows-like semantics
The Faust semantics is almost the same as that of Haskell's Arrows type class.
However, the Arrow type class is not bound to signal processors.
class="wikitable"
|+ Equivalences between FAUST and Arrow combinators | | {{code|2=haskell|1=loop ((\(a,b) -> (b,a)) ^>> f >>> id &&& (delay>>>g))}} where delay is not a method of the Arrow type class, but is specific to signal processing arrows |
f,g | f***g |
f:g | f>>>g |
f<:g | f>>^h>>>g with appropriate function h (or &&& in special cases) |
f:>g | f>>^h>>>g with appropriate function h |
The Arrow combinators are more restrictive than their FAUST counterparts, e.g., the nesting of parallel composition is preserved, and inputs of the operands of &&&
must match exactly.
References
{{Reflist}}
{{Refbegin}}
- {{cite journal
| first1 = Romain
| last1 = Michon
| first2 = Julius O. III
| last2 = Smith
| title = Faust-STK: a Set of Linear and Nonlinear Physical Models for the Faust Programming Language
| journal = Proceedings of the 11th Int. Conference on Digital Audio Effects (DAFx-11)
| url = http://recherche.ircam.fr/pub/dafx11/Papers/20_e.pdf
| pages = 199–204
| year = 2011
}}
- {{cite journal
| first1 = Dominique
| last1 = Fober
| first2 = Yann
| last2 = Orlarey
| first3 = Stéphane
| last3 = Letz
| title = Faust Architectures Design and OSC Support
| journal = Proceedings of the 11th Int. Conference on Digital Audio Effects (DAFx-11)
| url = http://recherche.ircam.fr/pub/dafx11/Papers/29_e.pdf
| pages = 213–216
| year = 2011
}}
- {{cite journal
| first1 = Julius O. III
| last1 = Smith
| first2 = Romain
| last2 = Michon
| title = Nonlinear Allpass Ladder Filters in Faust
| journal = Proceedings of the 11th Int. Conference on Digital Audio Effects (DAFx-11)
| url = http://recherche.ircam.fr/pub/dafx11/Papers/38_e.pdf
| pages = 361–364
| year = 2011
}}
- {{cite journal
|first1=Pierre
|last1=Jouvelot
|first2=Yann
|last2=Orlarey
|title=Dependent Vector Types for Data Structuring in Multirate Faust
|journal=Computer Languages, Systems & Structures
|url=http://faust.grame.fr/images/faust-doc/papers/faust-elsevier2011.pdf
|year=2011
|volume=37
|issue=3
|pages=113–131
|doi=10.1016/j.cl.2011.03.001
}}{{dead link|date=December 2016 |bot=InternetArchiveBot |fix-attempted=yes }}
- {{Cite web
| first = Julius O.
| last = Smith III
| title = Audio Signal Processing in Faust
| url = https://ccrma.stanford.edu/~jos/spf/aspf.pdf
| year = 2011
}}
- {{cite journal
|first3=Dominique
|last3=Fober
|first1=Yann
|last1=Orlarey
|first2=Stéphane
|last2=Letz
|title=Automatic Parallelization of Audio Applications with Faust
|journal=Proceedings of the Congrès Français d'Acoustique
|url=http://faust.grame.fr/images/faust-doc/papers/faust-CFA-2010.pdf
|year=2010
}}{{dead link|date=December 2016 |bot=InternetArchiveBot |fix-attempted=yes }}
- {{cite journal
| first3 = Dominique
| last3 = Fober
| first2 = Yann
| last2 = Orlarey
| first1 = Stéphane
| last1 = Letz
| title = Work Stealing Scheduler for Automatic Parallelization in Faust
| journal = Proceedings of the Linux Audio Conference (LAC-2010)
| url = http://lac.linuxaudio.org/2010/papers/17.pdf
| year = 2010
}}
- {{cite journal
| first = Albert
| last = Gräf
| title = Term rewriting extension for the Faust programming language
| journal = Proceedings of the 8th International Linux Audio Conference (LAC-2010)
| url = http://lac.linuxaudio.org/2010/download/lac2010proceedings.pdf
| page = 117
| year = 2010
}}
- {{cite journal
|first1=Jérôme
|last1=Barthélemy
|first2=Alain
|last2=Bonardi
|first3=Yann
|last3=Orlarey
|first4=Serge
|last4=Lemouton
|first5=Raffaele
|last5=Ciavarella
|first6=Karim
|last6=Barkati
|title=First Steps Towards an Organology of Virtual Instruments in Computer Music
|journal=Proceedings of the 2010 International Computer Music Conference (ICMA-2010)
|url=http://faust.grame.fr/images/faust-doc/papers/astree-icmc2010.pdf
|pages=369–372
|year=2010
}}{{dead link|date=December 2016 |bot=InternetArchiveBot |fix-attempted=yes }}
- {{cite journal
| first1 = Pierre
| last1 = Jouvelot
| first2 = Yann
| last2 = Orlarey
| title = Depandant Vector Types for Multirate Faust
| journal = Proceedings of the 7th Sound and Music Computing Conference (SMC-2010)
| url = http://smcnetwork.org/files/proceedings/2010/51.pdf
| pages = 345–352
| year = 2010
| access-date = 2011-10-11
| archive-url = https://web.archive.org/web/20120407043121/http://smcnetwork.org/files/proceedings/2010/51.pdf
| archive-date = 2012-04-07
| url-status = dead
}}
- {{cite journal
|first3=Dominique
|last3=Fober
|first1=Yann
|last1=Orlarey
|first2=Stéphane
|last2=Letz
|title=Adding Automatic Parallelization to Faust
|journal=Proceedings of the Linux Audio Conference (LAC-2009)
|url=http://faust.grame.fr/test/images/faust-doc/papers/faustLAC09.pdf
|year=2009
}}{{dead link|date=December 2016 |bot=InternetArchiveBot |fix-attempted=yes }}
- {{cite book
| first1 = Pierre
| last1 = Jouvelot
| first2 = Yann
| last2 = Orlarey
| chapter = Semantics for Multirate Faust
| title = Technical Repports of Centre de Recherche en Informatique de MINES ParisTech
| url = http://faust.grame.fr/images/faust-doc/papers/multirate-faust.pdf
| year = 2009
}}{{Dead link|date=December 2019 |bot=InternetArchiveBot |fix-attempted=yes }}
- {{cite journal
| first2 = Dominique
| last2 = Fober
| first1 = Yann
| last1 = Orlarey
| first3 = Stéphane
| last3 = Letz
| title = Parallelization of Audio Applications with Faust
| url = http://smc2009.smcnetwork.org/programme/pdfs/232.pdf
| year = 2009
}}
- {{cite book
| first2 = Dominique
| last2 = Fober
| first1 = Yann
| last1 = Orlarey
| first3 = Stéphane
| last3 = Letz
| chapter = Faust: an Efficient Functional Approach to DSP Programming
| title = New Computanionals Paradigms for Computer Music
| url = http://faust.grame.fr/images/faust-doc/papers/faust-delatour2009.pdf
| publisher = Edition Delatour
| isbn = 978-2-7521-0054-2
| year = 2009
}}{{Dead link|date=December 2019 |bot=InternetArchiveBot |fix-attempted=yes }}
- {{cite journal
|first3=Dominique
|last3=Fober
|first1=Yann
|last1=Orlarey
|first2=Stéphane
|last2=Letz
|title=Multicore Technologies in Jack and Faust
|journal=Proceedings of the 2010 International Computer Music Conference (ICMC-2008)
|url=http://faust.grame.fr/images/faust-doc/papers/jack-faust-multicore.pdf
|year=2008
}}{{dead link|date=December 2016 |bot=InternetArchiveBot |fix-attempted=yes }}
- {{cite journal
| first = Albert
| last = Gräf
| title = Interfacing Pure Data with Faust
| journal = Proceedings of the 5th International Linux Audio Conference (LAC2007)
| url = http://lac.linuxaudio.org/2007/download/lac07_proceedings.pdf
| page = 24
| year = 2007
}}
- {{Cite book
| first = Julius O.
| last = Smith III
| title = Introduction to Digital Filters: With Audio Applications
| chapter = Appendix K. Digital Filtering in Faust and PD
| publisher = W3K Publishing
| year = 2007
| isbn = 978-0-9745607-1-7
| chapter-url = https://books.google.com/books?id=pC1iCQUAsHEC&pg=PA417
| pages = 417–?
}}
- {{cite journal
| first1 = Albert
| last1 = Gräf
| first2 = Stefan
| last2 = Kersten
| first3 = Yann
| last3 = Orlarey
| title = DSP Programming with Faust, Q and SuperCollider
| journal = Proceedings of the 4th International Linux Audio Conference (LAC2006)
| url = http://lac.zkm.de/2006/papers/lac2006_orlarey_et_al.pdf
| year = 2006
}}
- {{cite journal
| first1 = Robert
| last1 = Trausmuth
| first2 = Christian
| last2 = Dusek
| first3 = Yann
| last3 = Orlarey
| title = Using Faust for FPGA Programming
| journal = Proceedings of the 9th Int. Conference on Digital Audio Effects (DAFx-09)
| url = http://www.dafx.ca/proceedings/papers/p_287.pdf
| year = 2006
}}
- {{Cite book
| first1 = Yann
| last1 = Orlarey
| first2 = Dominique
| last2 = Fober
| first3 = Stephone
| last3 = Letz
| chapter = Demonstration of Faust Signal Processing Language
| title = Proceedings of the International Computer Music Conference
| volume = 2005
| publisher = Computer Music Association
| url = http://quod.lib.umich.edu/cgi/t/text/text-idx?c=icmc;idno=bbp2372.2005.*
| chapter-url = http://quod.lib.umich.edu/i/icmc/bbp2372.2005.054?view=image
| year = 2005
| page = 286
}}
- {{cite book
| first2 = Dominique
| last2 = Fober
| first1 = Yann
| last1 = Orlarey
| first3 = Stéphane
| last3 = Letz
| chapter = Syntactical and Semantical Aspects of Faust
| title = Soft Computing
| url = http://faust.grame.fr/images/faust-doc/papers/faust-soft-computing.pdf
| year = 2004
}}{{Dead link|date=December 2019 |bot=InternetArchiveBot |fix-attempted=yes }}
- {{cite journal
|first1=Nicolas
|last1=Scaringella
|first3=Dominique
|last3=Fober
|first2=Yann
|last2=Orlarey
|title=Automatic Vectorization in Faust
|journal=Journée de l'Informatique Musicale (JIM-2003)
|url=http://faust.grame.fr/images/faust-doc/papers/JIM2003vect.pdf
|year=2003
}}{{dead link|date=December 2016 |bot=InternetArchiveBot |fix-attempted=yes }}
- {{cite journal
|first3=Stéphane
|last3=Letz
|first2=Dominique
|last2=Fober
|first1=Yann
|last1=Orlarey
|title=An Algebraic Approach to Block Diagram Constructions
|journal=Journée de l'Informatique Musicale (JIM-2002)
|url=http://faust.grame.fr/images/faust-doc/papers/faust-jim2002.pdf
|year=2002
}}{{dead link|date=December 2016 |bot=InternetArchiveBot |fix-attempted=yes }}
- {{cite journal
|first3=Stéphane
|last3=Letz
|first2=Dominique
|last2=Fober
|first1=Yann
|last1=Orlarey
|title=An Algebra for Block Diagram Languages
|journal=Proceedings of International Computer Music Conference (ICMA-2002)
|url=http://faust.grame.fr/images/faust-doc/papers/faust-icmc2002.pdf
|year=2002
}}{{dead link|date=December 2016 |bot=InternetArchiveBot |fix-attempted=yes }}
{{Refend}}
External links
{{Commons category|FAUST (programming language)}}
- {{Official website|faust.grame.fr}}, online compiler, support, documentation, news, etc.