linux: shared memory interface - link with librt
[supercollider.git] / HelpSource / Classes / Linen.schelp
blob059b661a2f7979ac089436371c4e1c3f32f311b0
1 class:: Linen
2 summary:: Simple linear envelope generator.
3 categories::  UGens>Envelopes
4 related:: Classes/EnvGen
6 Description::
8 Simple linear envelope generator.
11 classmethods::
13 method::kr
15 argument::gate
17 This triggers the envelope and holds it open while > 0.
19 If strong::gate:: < 0, force release with time code:: -1.0 - gate ::, see link::Classes/EnvGen#forced_release::.
21 argument::attackTime
23 The duration of the attack portion.
26 argument::susLevel
28 The level of the sustain portion.
31 argument::releaseTime
33 The duration of the release portion.
36 argument::doneAction
38 An integer representing an action to be executed when the
39 envelope is finished. See
40 link::Reference/UGen-doneActions::  for
41 more detail.
44 Examples::
46 code::
48 // trigged
50 SynthDef("help-Linen",{ arg out = 0;
51         Out.ar(out,
52                 Linen.kr(Impulse.kr(2), 0.01, 0.6, 1.0, doneAction: 0) * SinOsc.ar(440, 0, 0.1)
53         )
54 }).play;
57 // play once and end the synth
59 SynthDef("help-Linen",{ arg out=0;
60         Out.ar(out,
61                 Linen.kr(Impulse.kr(0), 0.01, 0.6, 1.0, doneAction: 2) * SinOsc.ar(440, 0, 0.1)
62         )
63 }).play;
66 // play once and sustain
68 x = SynthDef("help-Linen",{ arg gate = 1, out = 0; // use gate arg for release
69         Out.ar(out,
70                 Linen.kr(gate, 0.01, 0.6, 1.0, doneAction: 2) * SinOsc.ar(440, 0, 0.1)
71         )
72 }).play;
74 x.release(4); // change the release time
76 // longer gate, can pass in duration
78 SynthDef("help-Linen",{ arg out = 0, dur = 0.1;
79         var gate;
80         gate = Trig.kr(1.0, dur);
81         Out.ar(out,
82                 Linen.kr(gate, 0.01, 0.6, 1.0, doneAction: 2) * SinOsc.ar(440, 0, 0.1)
83         )
84 }).play(nil, [\out, 0, \dur, 2.0]);
89 // used below in a Routine varying the releaseTime
91 SynthDef("help-Linen",{ arg out=0,freq=440,attackTime=0.01,susLevel=0.6,releaseTime=0.1;
92         Out.ar(out,
93                 Linen.kr(Impulse.kr(0), attackTime, susLevel, releaseTime, doneAction: 2)
94                         * SinOsc.ar(freq, 0, 0.1)
95         )
96 }).send(s);
100 // debussey sleeping through math class
101 x = Pbrown(0.01, 2.0, 0.2, inf).asStream;
102 Routine({
103         loop({
104                 Synth.grain("help-Linen",[\freq, (rrand(20, 50) * 2).midicps, \releaseTime, x.next]);
105                 0.25.wait;
106         })
107 }).play(TempoClock.default)
115 SynthDef("help-Linen",{ arg out = 0;
116         Out.ar(out,
118                 Linen.kr(Impulse.kr(2),
119                         0.01,
120                         // sustain level is polled at time of trigger
121                         FSinOsc.kr(0.1).range(0, 1),
122                         1.0,
123                         doneAction: 0)
125                         * SinOsc.ar(440, 0, 0.1)
126         )
127 }).play;