This file is indexed.

/usr/share/SuperCollider/HelpSource/Classes/NamedControl.schelp is in supercollider-common 1:3.8.0~repack-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
class:: NamedControl
categories:: UGens>Synth control
summary:: Named reference to a control
related:: Classes/ControlName, Classes/Control

description::

A NamedControl directly combines a ControlName and a Control UGen conveniently. Also this makes it safe even if several identical controls exist (see example below).

There are syntax shortcuts that generate NamedControls from the name:
code::
\name.ar(values, lags)
\name.kr(values, lags, fixedLag)
\name.ir(values, lags)
\name.tr(values, lags)
::

ClassMethods::
method:: ar
add a new instance of link::Classes/AudioControl:: with given name and default values.
If lags are given, apply a Lag UGen to it.
discussion::
code::\symbol.ar(values, lags):: is a synonym.

method:: kr
add a new instance of link::Classes/Control:: (kr) with given name and default values.
If lags are given, apply a link::Classes/Lag:: UGen to it. If fixedLag is set to true, create a link::Classes/LagControl::
(lags cannot be modulated then, but fewer UGens are required).
discussion::
code::\symbol.kr(values, lags, fixedLag):: is a synonym.

method:: ir
add a new instance of link::Classes/Control:: (ir) with given name and default values.
If lags are given, apply a link::Classes/Lag:: UGen to it.
discussion::
code::\symbol.ir(values, lags):: is a synonym.

method:: tr
add a new instance of link::Classes/TrigControl:: with given name and default values.
If lags are given, apply a link::Classes/Lag:: UGen to it.
discussion::
code::\symbol.tr(values, lags):: is a synonym.

method:: new
add a new instance with the given rate, name and default values.
If lags are given, apply a link::Classes/Lag:: UGen to it. If fixedLag is set to true, create a link::Classes/LagControl::
(lags cannot be modulated then, but fewer UGens are required).

Examples::
code::
// use NamedControl to create a number of multichannel controls:

a = { SinOsc.ar(NamedControl.kr(\freq, [300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;
a.setn(\freq, [700, 705, 890]);
a.setn(\freq, [0, 2, 5].midiratio * 400);

// synonymous:
a = { SinOsc.ar(\freq.kr([300, 330, 370], [1, 0.3, 0.02])).sum * 0.1 }.play;

// multiple usage of the same name:
a = { SinOsc.ar(\freq.kr(440, 3.5)) + Saw.ar(\freq.kr(440, 0.05) * 0.5) * 0.1 }.play;


a.set(\freq, 1220)
a.set(\freq, 120)
::

subsection:: Comparison with direct use of Controls

In the situation when functions are used to combine UGens to more complex SynthDefs, it may not be known which ControlNames are already taken by others. NamedControl allows to reuse existing control names.
code::
// compare:
(
a = {
	var x, y;
	x = NamedControl.kr(\freq, 440, 3.5);
	y = NamedControl.kr(\freq, 440, 1);
	SinOsc.ar([x, y] * [2, 1.2]) * 0.1
}.play;
)

a.set(\freq, 1220)
a.set(\freq, 120)

(
a = {
	var x, y;
	x = Control.names([\freq]).kr(440).lag(3.5);
	y = Control.names([\freq]).kr(440).lag(1);
	SinOsc.ar([x, y] * [2, 1.2]) * 0.1
}.play;
)

a.set(\freq, 1220)
a.set(\freq, 120)
::

subsection:: Using dictionary with functions to build SynthDefs
Here is a basic example using a dictionary with functions that can be combined to build SynthDefs.
code::
(
q = ();
q.makeEnv = { |q, env, doneAction = 0| EnvGen.kr(env, NamedControl.kr(\gate, 1), doneAction: doneAction) };
q.chooseNoise = { [ {PinkNoise.ar}, {WhiteNoise.ar}, {LFNoise2.ar(Rand(100, 1000))}].choose.value};
q.filterInput = { |q, in| [
	{ BPF.ar(in * 15, NamedControl.kr(\freq, 800), 0.2) },
	{ RHPF.ar(in, NamedControl.kr(\freq, 800, 0.2), 0.2) }
	].choose.value
};
)

// test the envelope:
a = { SinOsc.ar(440) * q.makeEnv(Env.asr, 2) * 0.1 }.play;
a.set(\gate, -3); // release in 3 seconds

// single channel:
a = { q.chooseNoise * q.makeEnv(Env.asr, 2) }.play;
a.set(\gate, -3); // release in 3 seconds

a = { q.filterInput(q.chooseNoise) * q.makeEnv(Env.asr, 2) }.play;
a.set(\freq, 1000); // set filter frequency
a.set(\gate, -3); // release in 3 seconds

(
a = {
	var channels = Array.fill(8, {
		q.filterInput(q.chooseNoise) * q.makeEnv(Env.asr, 2)
	});
	Splay.ar(channels);

}.play;
)
a.set(\freq, 6000); // set filter frequency
a.set(\gate, -3); // release in 3 seconds
::