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. You can think of these composition operators as a generalization of the mathematical function composition operator.
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) |
Let’s say that we want to connect the output of + to the input of abs in order to compute the absolute value of the output signal. This connection can be done using the sequential composition operator ':' (colon):
process = + : abs;Here is an example of parallel composition (a stereo cable) using the operator ',' that puts in parallel its left and right expressions:
process = _,_;These operators can be arbitrarily combined. For example to multiply the input signal by 0.5 one can write:
process = _,0.5 : *;Taking advantage of some syntactic sugar the above example can be rewritten (using what functional programmers know as curryfication):
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 the 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 = + ~ _;Read more about this topic: FAUST (programming Language)
Famous quotes containing the word composition:
“Boswell, when he speaks of his Life of Johnson, calls it my magnum opus, but it may more properly be called his opera, for it is truly a composition founded on a true story, in which there is a hero with a number of subordinate characters, and an alternate succession of recitative and airs of various tone and effect, all however in delightful animation.”
—James Boswell (17401795)