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:
“There is singularly nothing that makes a difference a difference in beginning and in the middle and in ending except that each generation has something different at which they are all looking. By this I mean so simply that anybody knows it that composition is the difference which makes each and all of them then different from other generations and this is what makes everything different otherwise they are all alike and everybody knows it because everybody says it.”
—Gertrude Stein (18741946)