ArticleslgStudy

science

FAUST (programming language)

FAUST (programming language) is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand FAUST (programming language) rather than just read about it. In short: FAUST (Functional AUdio STream) is a domain-specific purely functional, text-based visual 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.

FAUST (programming language) — main illustration
FAUST (programming language) — illustration

Key takeaways

  • FAUST (programming language) belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect FAUST (programming language) to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of FAUST (programming language) from memory before moving on to harder problems.

Reference excerpt

FAUST (Functional AUdio STream) is a domain-specific purely functional, text-based visual 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. It is free and open-source software released with a GNU General Public License (GPL).

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):

The FAUST compiler translates FAUST code into a C++ object, which may then interface with other C++ code to produce a full program. It can also transpile (translate) the FAUST digital signal processing (DSP) specification to: C, C++, C#, Cmajor, Codebox (Max), D, interpreter, Java, JSFX (REAPER), LLVM IR, Julia, Rust, and WebAssembly (Wast/Wasm). 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 can 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:

The second example copies the input signal to the output. It involves the _ primitive that denotes the identity function for signals:

Another example sums a stereo signal into a mono signal using the + primitive:

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.

Using the sequential composition operator : the output of + can be routed to the input of abs to compute the absolute value of the signal:

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.

These operators can be combined arbitrarily. The following code multiplies an input signal with 0.5:

The above may be rewritten in curried form:

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):

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.

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. This is not a direct representation of the C++ code generated, and is instead used to generate code that can calculate the mathematical function it denotes.

Arrows-like semantics The Faust semantics is almost the same as that of Haskell Arrows type class. However, the Arrow class is not bound to signal processors.

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.

Awards 2022 Open Science Award for Open Source Research Software in the category "Documentation".

References

External links

Official website, online compiler, support, documentation, news, etc. FAUST on GitHub

Illustrations

FAUST (programming language): Simple examples of block diagram composition
Simple examples of block diagram composition
FAUST (programming language): Screenshot of mixer.dsp (available in the FAUST distribution) using the jack-qt architecture
Screenshot of mixer.dsp (available in the FAUST distribution) using the jack-qt architecture

Worked examples

Example 1 — a first encounter with FAUST (programming language)

Start with the simplest possible case. Write down what FAUST (programming language) claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to FAUST (programming language) before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about FAUST (programming language) ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of FAUST (programming language)

In research
FAUST (programming language) appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses FAUST (programming language) in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
FAUST (programming language) is common in secondary-school and first-year university syllabi. It links to neighbouring topics Audio programming languages, Programming languages created in 2002, so understanding it makes those chapters shorter.
In everyday life
Look for FAUST (programming language) outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “FAUST (programming language)” →

How to study FAUST (programming language) in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what FAUST (programming language) means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain FAUST (programming language) out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is FAUST (programming language) in simple terms?

FAUST (Functional AUdio STream) is a domain-specific purely functional, text-based visual 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…

Why does FAUST (programming language) matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study FAUST (programming language)?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on FAUST (programming language).

Tags

  • Audio programming languages
  • Programming languages created in 2002

Keep exploring