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.
66 lines
1.9 KiB
Plaintext
66 lines
1.9 KiB
Plaintext
(
|
|
~notes = Array.newClear(128); // Initialize the array to store synths
|
|
|
|
// Handle noteOn for MIDI device 8454149 (first device)
|
|
MIDIdef.noteOn(\noteOnTest_device1, {
|
|
arg vel, nn, chan, src;
|
|
[vel, nn, src].postln; // Post the velocity, note number, and source to the console
|
|
|
|
// Only respond to MIDI input from source 8454149 (device 1)
|
|
if (src == 8454147, {
|
|
// Create a new synth for device 1
|
|
~notes[nn] = Synth.new(
|
|
\mellotron,
|
|
[
|
|
\freq, nn.midicps,
|
|
\amp, vel.linexp(1,127,0.01,0.3),
|
|
]
|
|
);
|
|
});
|
|
});
|
|
|
|
// Handle noteOff for MIDI device 8454149 (first device)
|
|
MIDIdef.noteOff(\noteOffTest_device1, {
|
|
arg vel, nn, chan, src;
|
|
[vel, nn, src].postln;
|
|
|
|
// Only respond to MIDI input from source 8454149 (device 1)
|
|
if (src == 8454147, {
|
|
// Turn off the synth and free the memory for device 1
|
|
~notes[nn].set(\gate, 0);
|
|
~notes[nn] = nil;
|
|
});
|
|
});
|
|
|
|
// Handle noteOn for MIDI device 8454145 (second device)
|
|
MIDIdef.noteOn(\noteOnTest_device2, {
|
|
arg vel, nn, chan, src;
|
|
[vel, nn, src].postln; // Post the velocity, note number, and source to the console
|
|
|
|
// Only respond to MIDI input from source 8454145 (device 2)
|
|
if (src == 8454146, {
|
|
// Create a new synth for device 2
|
|
~notes[nn] = Synth.new(
|
|
\fm_pulsar_terrain,
|
|
[
|
|
\freq, nn.midicps,
|
|
\amp, vel.linexp(1,127,0.01,0.3),
|
|
]
|
|
);
|
|
});
|
|
});
|
|
|
|
// Handle noteOff for MIDI device 8454145 (second device)
|
|
MIDIdef.noteOff(\noteOffTest_device2, {
|
|
arg vel, nn, chan, src;
|
|
[vel, nn, src].postln;
|
|
|
|
// Only respond to MIDI input from source 8454145 (device 2)
|
|
if (src == 8454146, {
|
|
// Turn off the synth and free the memory for device 2
|
|
~notes[nn].set(\gate, 0);
|
|
~notes[nn] = nil;
|
|
});
|
|
});
|
|
|
|
) |