\duration -> 0,
\stopRec -> { |zi|
"stopRec called".postln;
- zi.duration = thisThread.seconds - zi.startTime;
+ zi.duration = min(thisThread.seconds - zi.startTime, 10);
zi.recSynth.free;
if (zi.pleiPich, {
zi.pichSint.set(\gate, 0);
});
+ zi.buf.loadToFloatArray(zi.startPos*zi.buf.sampleRate, zi.duration*zi.buf.sampleRate, action: { |array|
+ { zi.plotter.value = array; }.defer;
+ });
},
\playSample -> { |zi|
"playSample called".postln;
},
\shiftPos -> { |zi, delta|
var endPos = zi.startPos + zi.duration;
- "shiftPos called".postln;
+ ("shiftPos called"++[delta, endPos, zi.startPos, zi.duration]).postln;
zi.startPos = (zi.startPos + delta).clip(0, endPos);
zi.duration = endPos - zi.startPos;
- }
+ zi.buf.loadToFloatArray(zi.startPos*zi.buf.sampleRate, zi.duration*zi.buf.sampleRate, action: { |array|
+ if (array.size == 0, {array = [0]});
+ { zi.plotter.value = array; }.defer;
+ });
+ },
+ \window -> Window.new(
+ "Sampler",
+ Rect(Window.screenBounds.width-600,Window.screenBounds.height-180,500,100)
+ )
];
sampler.know = true;
+ sampler.plotter = Plotter.new("sampler", Rect(0, 0, sampler.window.bounds.width, sampler.window.bounds.height), sampler.window);
+
+ sampler.window.front;
+
"Сэмплер готов к использованию 😊".postln;
sampler;
~se = ~samplerFactory.value;
~pe = ~pedalFactory.value;
)
+~se.window.front
+
+(
+~se.buf.loadToFloatArray(action: { |array|
+ {
+ ~data = array;
+ "loading done".postln;
+ }.defer;
+ ~se.window.front;
+});
+)
+
+~se.soundView.setData(~data, 1024, samplerate: ~se.buf.sampleRate);
+
+~se.soundView.data
(\freq: 220).play;
~notes = Array.newClear(128);
~amps = Array.newClear(128);
~pe.suDown = { |zi|
- ~se.startRec(true);
+ ~se.startRec(false);
};
~pe.suUp = { |zi|
~se.stopRec();
var freq;
~push.padLight(row, col, 0, 0, false, 1);
freq = Scale.major.degreeToFreq(col, 0.midicps, row+1);
- ~notes[freq.cpsmidi.asInteger].set(\gate, 0);
+ //~notes[freq.cpsmidi.asInteger].set(\gate, 0);
~amps[freq.cpsmidi.asInteger] = 0;
};
~push.padPressure = { |zi, row, col, vel|