Start/stop by pressing button
authorEugene Petkevich <nasedil.genio.code@gmail.com>
Sun, 8 May 2022 19:51:18 +0000 (22:51 +0300)
committerEugene Petkevich <nasedil.genio.code@gmail.com>
Sun, 8 May 2022 19:51:18 +0000 (22:51 +0300)
push-control.scd
test.scd

index cfd718a..c5d68a8 100644 (file)
   // The following is working by itself,
   // but factory function assignment to global var
   // returns nil
-  /*
-  try {
+  /*try {
     // linux
     push.pushOut = MIDIOut.newByName("Ableton Push", "Ableton Push MIDI 2");
   }{
     // mac os
     push.pushOut = MIDIOut.newByName("Ableton Push", "User Port");
-  };
-  */
+  };*/
+
   push.pushOut.latency_(0);
   if (push.pushOut==nil, {"Cannot control push LEDs!"});
 
index 47a77fc..322efd9 100644 (file)
--- a/test.scd
+++ b/test.scd
@@ -7,13 +7,20 @@
 
 ~se.makeSynthEvent
 ~se.makeSynthArgs
+~recording = false;
 
 (
 ~push.recDown = { |zi|
-  ~se.startRec();
+  if (~recording, {
+    ~se.stopRec();
+    ~recording = false;
+  }, {
+    ~se.startRec();
+    ~recording = true;
+  });
 };
 ~push.recUp = { |zi|
-  ~se.stopRec();
+  //~se.stopRec();
 };
 ~push.playDown = { |zi|
   ~se.playSample();
@@ -28,8 +35,7 @@
   var note, amp;
   ~push.padLight(row, col, 2, 1, false, 0);
   note = Scale.major.degreeToFreq(col, 0.midicps, row+1);
-  amp = vel.linlin(1, 127, 0.01, 0.4);
-  Synth(~se.synthName, ~se.makeSynthArgs++[\freq, note]);
+  Synth(~se.synthName, ~se.makeSynthArgs++[\freq, note, \amp, vel]);
 };
 ~push.padUp = { |zi, row, col, vel|
   ~push.padLight(row, col, 0, 0, false, 1);