Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Env/event documentation error #638

Closed
timblechmann opened this issue Nov 3, 2012 · 1 comment
Closed

Env/event documentation error #638

timblechmann opened this issue Nov 3, 2012 · 1 comment
Labels
comp: SCDoc scdoc syntax, parser, and renderer. for changes to schelp files, use "comp: help"

Comments

@timblechmann
Copy link
Contributor

the following part from the Env documentation does not work as expected:

(
SynthDef(\help_Env_newClear, { |out = 0|
    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
}).add;
)

// reset then play again:
Synth(\help_Env_newClear, [\gate, 1, \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;

the Synth() example works, but the Event example does not ...

@jamshark70
Copy link
Contributor

I see why. By default, a SynthDesc doesn't include \gate from the event in the arguments sent to the synth. If the gate control's default is 0, as in this example, the gate is not opened and the envelope doesn't start... or end, leaving a zombie node.

The easiest fix is to add a nonzero default for \gate.tr (and while we're at it, replace the "magic" syntax with explicit invocations of NamedControl -- I'm coming to feel more and more that the docs should avoid syntax sugar, unless the sugar itself is what's being documented, certainly not the case here).

timblechmann added a commit that referenced this issue Nov 4, 2012
fixes #638

Signed-off-by: Tim Blechmann <tim@klingt.org>
(cherry picked from commit dbf8eae)
sofakid pushed a commit to sofakid/supercollider that referenced this issue Apr 6, 2015
fixes supercollider#638

Signed-off-by: Tim Blechmann <tim@klingt.org>
(cherry picked from commit e40e558)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: SCDoc scdoc syntax, parser, and renderer. for changes to schelp files, use "comp: help"
Projects
None yet
Development

No branches or pull requests

2 participants