Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions MIDI/tomaszpio_APC Pad Blinker (Sync to Transport).jsfx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
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.

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)

@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
note = slider1;
should_blink = slider2;
color = slider3;

@block
// Read host tempo (BPM); use 120 if unavailable
tempo = tempo > 0 ? tempo : 120;
interval = 60 / tempo; // quarter-note period

// `play_state` is provided by host (nonzero when playing/recording)

@sample
beat_timer += 1 / srate;

velocity = 0;

// 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);