10_Controls:
Filter:
Tutorials/Mark_Polishook_tutorial | Tutorials > Mark_Polishook_tutorial

10_Controls

Mark Polishook tutorial

Evaluate

and examine the box that lists the controls for each synth.

Controls (usually) are arguments

Use controls, which most often are defined as arguments in a ugenGraphFunc, to give information to a synth, either when it is created and/or after it is running. Supply default values to the arguments to make code more readable and to protect against user error (such as forgetting to supply a value to an argument).

////////////////////////////////////////////////////////////////////////////////////////////////////

Write controls names and appropriate values in the array given as an argument to a synth. Control names can be given as symbols (a unique name within the SuperCollider system).

or as as strings (an array of characters)

Either way, the pattern is

[ controlName, value, controlName, value, controlName, value].

See the Symbol and String files in the SuperCollider help system.

////////////////////////////////////////////////////////////////////////////////////////////////////

A third way to pass controls to a synth is as

In this case, the pattern is

[ controlIndex, value, controlIndex, value, controlIndex].

To adjust a control

Use the .set message to change the value of a control while a synth is running.

Environment variables

The '~' character before aSynth in the previous example defines an environment variable. An advantage to using an environment variable is that it doesn't have to be declared explicitly, as in

More precisely, the ~ character puts a variable named 'aSynth' into an instance of an object known as the currentEnvironment. For further information, see the Environment document in the SuperCollider help system.

In this usage, ~aSynth behaves like a global variable in other programming languages. By the strict definition, it isn't precisely global, but it may be used as such in SuperCollider.

Lag times

Use an array of lag times to state how long it takes to glide smoothly from one control value to another. Write the lag times in an array and place it in the synthdef after the ugenGraphFunc, as in

SynthDef templates

The array of lagtimes means that the synthdef template with two components (discussed in 07_SynthDefs)

can be revised to include three components.

////////////////////////////////////////////////////////////////////////////////////////////////////

go to 11_Test_functions