From fda35c4975cccb497aca2effb7d7b7807573401b Mon Sep 17 00:00:00 2001 From: tomaszpio Date: Sun, 21 Sep 2025 22:24:38 +0200 Subject: [PATCH 1/6] =?UTF-8?q?Release=20APC=20mini=20mk2=20=E2=80=94=20Pa?= =?UTF-8?q?d=20Blinker=20(sync=20to=20transport)=20v1.0.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\224 Pad Blinker (sync to transport).jsfx" | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 "MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" diff --git "a/MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" "b/MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" new file mode 100644 index 0000000..d13c724 --- /dev/null +++ "b/MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" @@ -0,0 +1,98 @@ +desc: APC mini mk2 — Pad Blinker (sync to transport) +author: tomaszpio +version: 1.0.0 + +desc:APC Pad Blinker (Sync to Transport) + +/* + - Pads 0..63: RGB via SysEx (APC mini mk2, header 47 7F 4F 24) + - Buttons 64..127: single-color LED via Note On velocity + - Blinks on every beat (quarter note) while transport is playing +*/ + +slider1:0<0,127,1>Pad MIDI Note +slider2:1<0,1,1{Off,On}>Blink + +// ------------------------- +// @init +// ------------------------- +@init +pad_note = 0; +blink_on = 1; + +beat_sec = 0.5; // will be set from tempo +t_accum = 0.0; +led_state = 0; + +channel = 0; // MIDI ch 1 (0..15) +status_on = $x90 | (channel & $x0F); +status_off = $x80 | (channel & $x0F); + +// Prebuilt SysEx header for APC mini mk2 RGB +// F0 47 7F 4F 24 00 08 F7 +sysex_len = 16; +sysex[0]=$xF0; sysex[1]=$x47; sysex[2]=$x7F; sysex[3]=$x4F; sysex[4]=$x24; +sysex[5]=$x00; sysex[6]=$x08; + +// ------------------------- +// helpers +// ------------------------- +function send_apc_rgb(off, pid, r7f, g7f, b7f)( + // clamp pad id to 0..63 per APC mk2 spec + pid &= $x3F; + sysex[7]=pid; sysex[8]=pid; + sysex[9]=0; sysex[10]=r7f&$x7F; + sysex[11]=0; sysex[12]=g7f&$x7F; + sysex[13]=0; sysex[14]=b7f&$x7F; + sysex[15]=$xF7; + midisend_buf(off, sysex, sysex_len); +); + +function send_note_led(off, ch, note, vel)( + // NoteOn for LED on buttons 64..127 + m1 = $x90 | (ch & $x0F); + m23 = ((vel & $x7F) << 8) | (note & $x7F); + midisend(off, m1, m23); +); + +// ------------------------- +// @slider +// ------------------------- +@slider +pad_note = slider1|0; +blink_on = slider2|0; + +// ------------------------- +// @block +// ------------------------- +@block +// tempo (BPM) -> seconds per beat +tempo > 0 ? (beat_sec = 60/tempo) : (beat_sec = 0.5); + +// accumulate time in seconds per block +t_accum += samplesblock/srate; + +// transport play? (JSFX udostępnia play_state: 0=stop,1=play,2=pause) +is_playing = (play_state == 1); + +// when playing & blinking enabled -> toggle on each beat +(is_playing && blink_on) ? ( + (t_accum >= beat_sec) ? ( + t_accum -= beat_sec; + led_state = led_state ? 0 : 1; + + pid = pad_note & $x7F; + + (pid <= 63) ? ( + // RGB pads (SysEx): ON = biała (127,127,127), OFF = 0 + r = led_state ? 127 : 0; + g = led_state ? 127 : 0; + b = led_state ? 127 : 0; + send_apc_rgb(0, pid, r, g, b); + ) : ( + // Buttons (64..127): NoteOn velocity toggled + vel = led_state ? 127 : 0; + send_note_led(0, channel, pid, vel); + ); + ); +); From 05cfcd42d69bcc3c28d2be494027233ee89e0b7b Mon Sep 17 00:00:00 2001 From: Christian Fillion Date: Sun, 21 Sep 2025 20:03:25 -0400 Subject: [PATCH 2/6] move documentation to package metadata and remove duplicate 'desc' tag --- ...i mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git "a/MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" "b/MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" index d13c724..7b731c1 100644 --- "a/MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" +++ "b/MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" @@ -1,14 +1,10 @@ desc: APC mini mk2 — Pad Blinker (sync to transport) author: tomaszpio version: 1.0.0 - -desc:APC Pad Blinker (Sync to Transport) - -/* +about: - Pads 0..63: RGB via SysEx (APC mini mk2, header 47 7F 4F 24) - Buttons 64..127: single-color LED via Note On velocity - Blinks on every beat (quarter note) while transport is playing -*/ slider1:0<0,127,1>Pad MIDI Note slider2:1<0,1,1{Off,On}>Blink From 11f8a0dcc4abd81d26be8f01685211987edd1252 Mon Sep 17 00:00:00 2001 From: tomaszpio Date: Thu, 25 Sep 2025 23:01:32 +0200 Subject: [PATCH 3/6] =?UTF-8?q?Update=20tomaszpio=5FAPC=20mini=20mk2=20?= =?UTF-8?q?=E2=80=94=20Pad=20Blinker=20(sync=20to=20transport).jsfx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...\224 Pad Blinker (sync to transport).jsfx" | 120 +++++++----------- 1 file changed, 43 insertions(+), 77 deletions(-) diff --git "a/MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" "b/MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" index 7b731c1..b8c1028 100644 --- "a/MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" +++ "b/MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" @@ -1,94 +1,60 @@ -desc: APC mini mk2 — Pad Blinker (sync to transport) +desc: APC Pad Blinker (Sync to Transport) author: tomaszpio version: 1.0.0 -about: - - Pads 0..63: RGB via SysEx (APC mini mk2, header 47 7F 4F 24) - - Buttons 64..127: single-color LED via Note On velocity - - Blinks on every beat (quarter note) while transport is playing - -slider1:0<0,127,1>Pad MIDI Note -slider2:1<0,1,1{Off,On}>Blink - -// ------------------------- -// @init -// ------------------------- -@init -pad_note = 0; -blink_on = 1; -beat_sec = 0.5; // will be set from tempo -t_accum = 0.0; -led_state = 0; +/* +about: +APC Mini mk2: blink a chosen pad LED **once per quarter note** while the DAW is **playing**. +- Output is via **Note On velocity** (single-color LED). +- Tempo comes from host `tempo` (falls back to 120 BPM). +- Uses pad note numbers (APC pads are typically 0–63; script slider allows up to 77). -channel = 0; // MIDI ch 1 (0..15) -status_on = $x90 | (channel & $x0F); -status_off = $x80 | (channel & $x0F); +Sliders: +1) Pad MIDI Note (0–77) — which pad to blink +2) Enable Blinking (Off/On) +3) Pad Color (0–127) — velocity used when LED is ON -// Prebuilt SysEx header for APC mini mk2 RGB -// F0 47 7F 4F 24 00 08 F7 -sysex_len = 16; -sysex[0]=$xF0; sysex[1]=$x47; sysex[2]=$x7F; sysex[3]=$x4F; sysex[4]=$x24; -sysex[5]=$x00; sysex[6]=$x08; +MIDI out (LED): status `0x96` (Note On, ch. 7), data1 = pad note, data2 = color or 0. +*/ -// ------------------------- -// helpers -// ------------------------- -function send_apc_rgb(off, pid, r7f, g7f, b7f)( - // clamp pad id to 0..63 per APC mk2 spec - pid &= $x3F; - sysex[7]=pid; sysex[8]=pid; - sysex[9]=0; sysex[10]=r7f&$x7F; - sysex[11]=0; sysex[12]=g7f&$x7F; - sysex[13]=0; sysex[14]=b7f&$x7F; - sysex[15]=$xF7; - midisend_buf(off, sysex, sysex_len); -); +slider1:0<0,77,1>Pad MIDI Note (0-63) +slider2:1<0,1,1{Off,On}>Enable Blinking +slider3:3<0,127,1>Pad Color (0-127) -function send_note_led(off, ch, note, vel)( - // NoteOn for LED on buttons 64..127 - m1 = $x90 | (ch & $x0F); - m23 = ((vel & $x7F) << 8) | (note & $x7F); - midisend(off, m1, m23); -); +@init +note = 0; +interval = 0.5; // seconds per beat (updated from tempo) +beat_timer = 0.0; +is_on = 0; // LED state toggle +should_blink = 1; // from slider2 +play_state = 0; // host transport state (read by JSFX) +color = 0; // from slider3 -// ------------------------- -// @slider -// ------------------------- @slider -pad_note = slider1|0; -blink_on = slider2|0; +note = slider1; +should_blink = slider2; +color = slider3; -// ------------------------- -// @block -// ------------------------- @block -// tempo (BPM) -> seconds per beat -tempo > 0 ? (beat_sec = 60/tempo) : (beat_sec = 0.5); - -// accumulate time in seconds per block -t_accum += samplesblock/srate; +// Read host tempo (BPM); use 120 if unavailable +tempo = tempo > 0 ? tempo : 120; +interval = 60 / tempo; // quarter-note period -// transport play? (JSFX udostępnia play_state: 0=stop,1=play,2=pause) -is_playing = (play_state == 1); +// `play_state` is provided by host (nonzero when playing/recording) -// when playing & blinking enabled -> toggle on each beat -(is_playing && blink_on) ? ( - (t_accum >= beat_sec) ? ( - t_accum -= beat_sec; - led_state = led_state ? 0 : 1; +@sample +beat_timer += 1 / srate; - pid = pad_note & $x7F; +velocity = 0; - (pid <= 63) ? ( - // RGB pads (SysEx): ON = biała (127,127,127), OFF = 0 - r = led_state ? 127 : 0; - g = led_state ? 127 : 0; - b = led_state ? 127 : 0; - send_apc_rgb(0, pid, r, g, b); - ) : ( - // Buttons (64..127): NoteOn velocity toggled - vel = led_state ? 127 : 0; - send_note_led(0, channel, pid, vel); +// Blink only when transport is active and blinking is enabled +(play_state ? ( + should_blink == 1 ? ( + beat_timer >= interval ? ( + beat_timer -= interval; + is_on = is_on == 0 ? 1 : 0; + velocity = is_on ? color : 0; + midisend(0, 0x96, note, velocity); // Note On LED update (ch. 7) ); ); -); +) : 0); From 50ebf1452d0e9160ccfac9d8b8720541758de888 Mon Sep 17 00:00:00 2001 From: Christian Fillion Date: Fri, 26 Sep 2025 01:14:32 -0400 Subject: [PATCH 4/6] make the about tag indexable --- ...\224 Pad Blinker (sync to transport).jsfx" | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git "a/MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" "b/MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" index b8c1028..f7eddb8 100644 --- "a/MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" +++ "b/MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" @@ -1,21 +1,18 @@ desc: APC Pad Blinker (Sync to Transport) author: tomaszpio version: 1.0.0 - -/* about: -APC Mini mk2: blink a chosen pad LED **once per quarter note** while the DAW is **playing**. -- Output is via **Note On velocity** (single-color LED). -- Tempo comes from host `tempo` (falls back to 120 BPM). -- Uses pad note numbers (APC pads are typically 0–63; script slider allows up to 77). - -Sliders: -1) Pad MIDI Note (0–77) — which pad to blink -2) Enable Blinking (Off/On) -3) Pad Color (0–127) — velocity used when LED is ON - -MIDI out (LED): status `0x96` (Note On, ch. 7), data1 = pad note, data2 = color or 0. -*/ + APC Mini mk2: blink a chosen pad LED **once per quarter note** while the DAW is **playing**. + - Output is via **Note On velocity** (single-color LED). + - Tempo comes from host `tempo` (falls back to 120 BPM). + - Uses pad note numbers (APC pads are typically 0–63; script slider allows up to 77). + + Sliders: + 1) Pad MIDI Note (0–77) — which pad to blink + 2) Enable Blinking (Off/On) + 3) Pad Color (0–127) — velocity used when LED is ON + + MIDI out (LED): status `0x96` (Note On, ch. 7), data1 = pad note, data2 = color or 0. slider1:0<0,77,1>Pad MIDI Note (0-63) slider2:1<0,1,1{Off,On}>Enable Blinking From 3eb547cb1c7ccfcc26e492aa6b047c43b8eeff01 Mon Sep 17 00:00:00 2001 From: Christian Fillion Date: Fri, 26 Sep 2025 01:15:43 -0400 Subject: [PATCH 5/6] make the filename match the new package name --- .../tomaszpio_APC Pad Blinker (Sync to Transport).jsfx | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename "MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" => MIDI/tomaszpio_APC Pad Blinker (Sync to Transport).jsfx (100%) diff --git "a/MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" b/MIDI/tomaszpio_APC Pad Blinker (Sync to Transport).jsfx similarity index 100% rename from "MIDI/tomaszpio_APC mini mk2 \342\200\224 Pad Blinker (sync to transport).jsfx" rename to MIDI/tomaszpio_APC Pad Blinker (Sync to Transport).jsfx From d2e04758b41d1544209fd2b71b46d2e769b1ce18 Mon Sep 17 00:00:00 2001 From: Christian Fillion Date: Fri, 26 Sep 2025 01:23:14 -0400 Subject: [PATCH 6/6] remove duplicate space after 'desc: ' --- MIDI/tomaszpio_APC Pad Blinker (Sync to Transport).jsfx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MIDI/tomaszpio_APC Pad Blinker (Sync to Transport).jsfx b/MIDI/tomaszpio_APC Pad Blinker (Sync to Transport).jsfx index f7eddb8..005f5c1 100644 --- a/MIDI/tomaszpio_APC Pad Blinker (Sync to Transport).jsfx +++ b/MIDI/tomaszpio_APC Pad Blinker (Sync to Transport).jsfx @@ -1,4 +1,4 @@ -desc: APC Pad Blinker (Sync to Transport) +desc: APC Pad Blinker (Sync to Transport) author: tomaszpio version: 1.0.0 about: