initial commit
This commit is contained in:
27
midi_in_gate.scd
Normal file
27
midi_in_gate.scd
Normal file
@ -0,0 +1,27 @@
|
||||
(
|
||||
MIDIClient.init;
|
||||
MIDIIn.connectAll;
|
||||
|
||||
MIDIFunc.trace(true);
|
||||
)
|
||||
|
||||
(
|
||||
~synths = Array.fill(127, nil);
|
||||
MIDIdef.noteOn(\on, {
|
||||
arg val, num, chan,src;
|
||||
if(~synths[num] == nil, { // To be absolutely save
|
||||
~synths[num] = Synth(\supersaw, [
|
||||
\amp, 0.1,
|
||||
\freq, num.midicps,
|
||||
\harm, exprand(4,20)]);
|
||||
});
|
||||
});
|
||||
|
||||
MIDIdef.noteOff(\off, {
|
||||
arg val, num, chan,src;
|
||||
if(~synths[num] != nil, { // To be absolutely safe
|
||||
~synths[num].set(\gate, 0);
|
||||
~synths[num] = nil; // Remove the reference
|
||||
});
|
||||
});
|
||||
)
|
||||
Reference in New Issue
Block a user