Next  |  Prev  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

## Primer on the FAUST Language

FAUST is a functional programming language  in which the ``main'' function, called process in FAUST, specifies a signal-processing block diagram.4A very simple example is

```    process(x) = x;
```
which defines a simple ``wire'' block diagram that connects its single input to its single output. We can also define a pair of wires for stereo operation:
```    process(x,y) = x,y;
```
Here we have introduced the comma block-diagram operator (,) on the righthand side which combines block diagrams in parallel. (On the lefthand side, a comma separates function arguments, which is a different usage of comma.)

Common block-diagram functions are predefined, such as `` '':

```    process(x,y) = x,y:+;
```
Now we have introduced the colon (:) operator for combining block diagrams in series. The block diagram consisting of two wires x and y in parallel is connected to the two inputs of the + block diagram.

Since the + operator already has two inputs, we do not need to refer to them explicitly. Thus,

```    process = +;
```
is equivalent to ``process(x,y) = x,y:+;'', and it therefore also specifies a block diagram consisting of two input signals, one output signal, and a summer, as shown in Fig.1. The underbar symbol _, also called a ``wire'', denotes the trivial block diagram that feeds its single input to its single output. Thus, using the predefined block diagram ``_'' we can define the ``mono wire'' function ``process(x)=x;'' as

```    process = _;
```
and the ``stereo bus'' as
```    process = _,_;
```
which is equivalent to ``process(x,y)=x,y;''.

The block diagram generated by faust -svg wire.dsp (as used by the script faust2firefox), where wire.dsp contains process=_;, is shown in Fig.2. Arguably even simpler is

```    process = 0;
```
where 0 can be thought of as a predefined block diagram having no input signals, and one output signal that is a stream of zeros. The block diagram for this is shown in Fig.3.

It is convenient to refer to a block diagram as a signal when it has no input signals and one output signal.

Similarly,

```    process = 1;
```
specifies a block diagram having no input signals and an output signal that is a stream of ones starting at time zero. Block-diagrams such as `0' and `1' may be thought of as constant signals. However, since a constant signal, as defined, is semantically a block diagram, all operations valid for block diagrams (listed below) can be applied. For example, using the one-sample-delay postfix operator ', we can specify the unit impulse signal by
```    impulse = 1 - 1';
```
because 1 is the unit-step signal (a unit constant turning on at time 0) and 1' is the unit-step delayed by one sample. Subsections
Next  |  Prev  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search