You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
scd/cc sine test.scd

22 lines
453 B
Plaintext

(
SynthDef(\sineCC, {
var freq = \freq.kr(440);
var sig = SinOsc.ar(freq) * 0.1;
Out.ar(0, sig ! 2);
}).add;
)
~sine = Synth(\sineCC);
(
~ccToFreq = MIDIdef.cc(\ccFreqControl, {
arg val, num, chan, src;
if (chan == 0 and: { num == 0 }, { // channel 2 = index 1
var freq = val.linexp(0, 127, 100, 2000); // map CC value to frequency range
~sine.set(\freq, freq);
("CC " ++ num ++ " = " ++ val ++ " → freq: " ++ freq).postln;
});
});
)