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.
/* 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 with { firpart(x) = x + g1 * x'''; feedback(v) = 0 - g2 * v''''; }; |
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 Fig.3.5.
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 Fig.3.6.
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.
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
import("music.lib");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.