The Faust language for signal processing is introduced in
Appendix K. Figure 3.4 shows a Faust program for
implementing our example comb filter. As illustrated in
Appendix K, such programs can be compiled to produce LADSPA or
VST audio plugins, or a Pure Data (PD) plugin, among others.
Faust main program implementing
the example digital filter. (Tested in Faust version 0.9.9.2a2.)
/* GUI Controls */
g1 = hslider("feedforward gain", 0.125, 0, 1, 0.01);
g2 = hslider("feedback gain", 0.59049, 0, 1, 0.01);
/* Signal Processing */
process = firpart : + ~ feedback
firpart(x) = x + g1 * x''';
feedback(v) = 0 - g2 * v'''';
As discussed in Appendix K
, a prime ('
) denotes delaying a
signal by one sample, and a tilde (~
) denotes feedback. A
) simply indicates a connection in series. The
feedback signal v
is delayed only four samples instead of
five because there is a free ``pipeline delay'' associated with the
Faust's -svg option causes a block-diagram to be written to
disk for each Faust expression (as further discussed in Appendix K).
The block diagram for our example comb filter is shown in
Block diagram generated by the
Faust -svg option.
Compiling the Faust code in Fig.3.4 for LADSPA plugin format
produces a plugin that can be loaded into ``JACK Rack'' as depicted in
JACK Rack screenshot for the
example comb filter.
At the risk of belaboring this mini-tour of filter embodiments in
common use, Fig.3.7 shows a screenshot of a PD test patch for
the PD plugin generated from the Faust code in Fig.3.4.
Pure Data (PD) screenshot for a test
patch exercising a PD plugin named cf.pd that was
generated automatically from the Faust code in Fig.3.4 using
the faust program and faust2pd script (see
Appendix K for details).
By the way, to change the Faust example of Fig.3.4 to include
its own driving noise, as in the STK example of Fig.3.3, we need
only add the line
at the top to define the noise
signal (itself only two lines
of Faust code), and change the process
definition as follows:
process = noise : firpart : + ~ feedback
In summary, the Faust language provides a compact representation for
many digital filters, as well as more general digital signal
processing, and it is especially useful for quickly generating
real-time implementations in various alternative formats.
Appendix K gives a number of examples.
Next Section: Impulse ResponsePrevious Section: Software Implementation in C++