From 6ad66afe4eca1efe265711bf59752ab306f963ae Mon Sep 17 00:00:00 2001 From: Eugene Petkevich Date: Sat, 7 May 2022 12:09:46 +0300 Subject: [PATCH] Fix bpm for blinking in push / add simple animation --- push-control.scd | 32 ++++++++++++++++++++++++++++++++ test.scd | 20 ++++++++++++++++++-- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/push-control.scd b/push-control.scd index 67d2785..9af48a4 100644 --- a/push-control.scd +++ b/push-control.scd @@ -10,6 +10,8 @@ var push = Environment[ \version -> "33.7.2.5", + \tempo -> 2, + \padColor -> IdentityDictionary[ \white -> 0, \red -> 1, @@ -225,6 +227,36 @@ zi.pushOut.free; }; + // todo — always send clocks, and separate start/stop from setting tempod + push.setTempo = { |zi, tempo| + { + zi.pushOut.start; + 1.do({ + 24.do({ + zi.pushOut.midiClock; + (1.0/zi.tempo/24).wait; + }); + }); + zi.pushOut.stop; + }.fork(); + }; + + // Starter message and animation + + { + (0..127).do({|i| + ~push.pushOut.noteOn(0, i, 1); + ~push.pushOut.control(0, i, 1); + }); + 1.wait; + (0..127).do({|i| + ~push.pushOut.noteOn(0, i, 0); + ~push.pushOut.control(0, i, 0); + }); + }.fork(); + + "Џяпюӈи готов к использованию 😊".postln; + push; }; ) diff --git a/test.scd b/test.scd index 37c0aff..7fc28e6 100644 --- a/test.scd +++ b/test.scd @@ -104,12 +104,26 @@ MIDIdef.freeAll; ~col = (~col + delta).clip(0, 127); ~col.postln; (0..127).do({|i| - ~push.pushOut.noteOn(0, i, ~col); + ~push.pushOut.noteOn(13, i, ~col); ~push.pushOut.control(0, i, ~col); }); }; ) +( +{ + ~tempo = 40; + ~push.pushOut.start; + 5.do({ + 24.do({ + ~push.pushOut.midiClock; + (60/~tempo/24).wait; + }); + }); + ~push.pushOut.stop; +}.fork(); +) + ~push.pushOut m = MIDIClockOut("Ableton Push", "Ableton Push MIDI 2"); @@ -140,4 +154,6 @@ try { Exception.new().throw; ret = 1; } { ret = 2 }; }; ) -~test = ~factory.value; \ No newline at end of file +~test = ~factory.value; + +~push.setTempo(1); \ No newline at end of file -- 2.17.1