Skip to content

Commit

Permalink
Help: Env - fix newClear example
Browse files Browse the repository at this point in the history
fixes #638

Signed-off-by: Tim Blechmann <tim@klingt.org>
(cherry picked from commit dbf8eae)
  • Loading branch information
timblechmann committed Nov 4, 2012
1 parent c389bc5 commit c67566a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions HelpSource/Classes/Env.schelp
Original file line number Diff line number Diff line change
Expand Up @@ -687,24 +687,23 @@ The loop jumps back to the loop node. The endpoint of that segment is the goal l
subsection::newClear
code::
(
SynthDef(\help_Env_newClear, { |out = 0|
SynthDef(\help_Env_newClear, { |out = 0, gate = 1|
var env, envctl;
// make an empty 4 segment envelope
env = Env.newClear(4);
// create a control argument array
envctl = \env.kr(env.asArray);
Out.ar(out, SinOsc.ar(EnvGen.kr(envctl, \gate.tr), 0, 0.3)); // the gate control is a trigger
Out.ar(out, SinOsc.ar(EnvGen.kr(envctl, gate), 0) * -12.dbamp);
}).add;
)

Synth(\help_Env_newClear, [\gate, 1, \env, Env([700,900,900,800], [1,1,1], \exp)]); // 3 segments
Synth(\help_Env_newClear, [\env, Env([700,900,900,800], [1,1,1], \exp)]); // 3 segments

// reset then play again:
Synth(\help_Env_newClear, [\gate, 1, \env, Env({ rrand(60, 70).midicps } ! 4, [1,1,1], \exp)]);
Synth(\help_Env_newClear, [ \env, Env({ rrand(60, 70).midicps } ! 4, [1,1,1], \exp)]);

// the same written as an event:
(instrument: \help_Env_newClear, gate: 1, env: Env({ rrand(60, 70).midicps } ! 4, [1,1,1], \exp)).play;

(instrument: \help_Env_newClear, env: Env({ rrand(60, 70).midicps } ! 4, [1,1,1], \exp)).play;
::

note:: The above technique currently doesn't work with multichannel expanded envelopes (See: link::#multichannel expansion::)::
Expand Down

0 comments on commit c67566a

Please sign in to comment.