--- /dev/null
+// MIDI pedals handler
+// by Eugene Zuelum
+
+(
+~pedalFactory = {
+ var pedal = Environment[
+ \version -> "33.7.3.4"
+ ];
+
+ pedal.know = true;
+
+ // Sustain pedal on/off
+ MIDIdef.cc(\midiPedalSustain, { |...args|
+ if (args[0] != 0, {
+ pedal.suDown(*args);
+ }, {
+ pedal.suUp(*args);
+ });
+ },
+ 65, 3);
+ // M-Audio Exp-M pedal (values range from 0 to 118 only)
+ MIDIdef.cc(\midiPedalExpression, { |...args|
+ var normed;
+ // m-audio
+ normed = args[0].linlin(0, 118, 0, 1);
+ pedal.xePres(normed, *args);
+ },
+ 64, 3);
+
+ pedal.freeDefs = { |zi|
+ MIDIdef(\midiPedalSustain).free;
+ MIDIdef(\midiPedalExpression).free;
+ };
+
+ "Нычосё и Щюҙуԉы готовы к использованию 😊".postln;
+
+ pedal;
+};
+)
+
+//============================================================================= Testing
+
+// Test incoming MIDI messages
+/*
+(
+MIDIdef.cc(\testcc, {|...args|
+(["cc"] ++ args).postln;
+});
+MIDIdef.noteOn(\testnoteon, {|...args|
+(["note on"] ++ args).postln;
+});
+MIDIdef.noteOff(\testnoteoff, {|...args|
+(["note off"] ++ args).postln;
+});
+MIDIdef.touch(\testtouch, {|...args|
+(["touch"] ++ args).postln;
+});
+MIDIdef.polytouch(\testpolytouch, {|...args|
+(["polytouch"] ++ args).postln;
+});
+MIDIdef.bend(\testbend, {|...args|
+(["bend"] ++ args).postln;
+});
+MIDIdef.sysex(\testsysex, {|...args|
+(["sysex"] ++ args).postln;
+});
+)
+*/
+
+// Test library
+/*
+~pe = ~pedalFactory.value;
+~pe.suUp = {"up".postln};
+~pe.suDown = {"down".postln};
+~pe.xePres = {|zi, val| val.postln};
+*/
sig = sig * amp;
Out.ar(out, sig!2);
}).add,
- \startRec -> { |zi|
+ \startRec -> { |zi, pleiPich=false|
"startRec called".postln;
zi.startPos = 0.0;
zi.recSynth = Synth(\samplerRecord, [\input, s.inputBus, \buf, zi.buf], addAction: \addToTail);
zi.endPos = s.sampleRate * 10;
zi.startTime = thisThread.seconds;
+ zi.pleiPich = pleiPich;
+ if (pleiPich, {
+ zi.pichSint = Synth(\default, [freq: 220]);
+ });
},
\startPos -> 0,
\duration -> 0,
"stopRec called".postln;
zi.duration = thisThread.seconds - zi.startTime;
zi.recSynth.free;
+ if (zi.pleiPich, {
+ zi.pichSint.set(\gate, 0);
+ });
},
\playSample -> { |zi|
var playSynth;
];
sampler.know = true;
+ "Сэмплер готов к использованию 😊".postln;
+
sampler;
};
)