Skip to content

Incorrect init value with CtkControl.env #27

@mkmarchan

Description

@mkmarchan

CtkControl.env appears to have the wrong initial value (2x the expected number). Here is a code snippet the reproduces the bug I'm seeing:

(
var synthDef;

synthDef = CtkSynthDef.new(\testSynthDef,
	{ arg freq = 440, gain = 0.0, dur = 1.0, outBus = 0;
		
		var trigger, sig, env, timer;
		
		env = EnvGen.ar(Env([0, 1, 1, 0], [0, dur, 0]), doneAction: 2);
		trigger = Impulse.ar(1.0);
		sig = SinOsc.ar(freq);
		
		SendTrig.ar(trigger, 0, freq);
		
		Out.ar(outBus, sig);
});

o = OSCFunc({ |msg|
	msg.postln;
}, "/tr", s.addr);

synthDef.note(starttime: 0.0, duration: 60)
.gain_(0.0)
.dur_(60)
.outBus_(0)
.freq_(CtkControl.env(Env([440, 440], [60], 'exp')))
.play;
)

The post window will show:
[ /tr, 1097, 0, 880.0 ]
[ /tr, 1097, 0, 440.0 ]
[ /tr, 1097, 0, 440.0 ]

Any insights into what's happening here? Has anyone run into this before?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions