Faust: Controlling Parameters

In Faust, control parameters are always declared with a graphic user interface element. For some targets, these elements are ignored. For GUI targets, however, they are automatically included in the final software. With the native Faust GUI, as used in standalone applications, an example with two parameters may look like this:

text


This example implements a sine wave generator with controllable frequency and amplitude. The following image shows the top level flow chart generated by Faust:

text


The frequency of the oscillator is controlled with a horizontal slider, whereas the element for controlling the gain is in knob style. Additional parameters (see the Faust documentation for details) define parameter ranges, initial value more.

Load this example in the Faust online IDE for a quick start:

import("stdfaust.lib");

// input parameters with GUI elements
freq  = hslider("frequency",100, 10, 1000, 0.001);
gain  = hslider("gain[style:knob]",0, 0, 1, 0.001);

// a sine oscillator with controllable frequency and amplitude:
process = os.osc(freq)*gain;