TEK2: let LED blink in BPM frequency

I use a button to start playback of my DAW (Qtractor). My DAW can send MIDI clock.

Is it possible that the LED above the button blinks in BPM speed when I send MIDI clock to the TEK2?

I gave up. Grid cannot process MIDI clock. I managed to write a mididings script that sends after 12 MIDI clock ticks a Note On and a Note Off after another 12 MIDI clock ticks but mididings’ process() doesn’t run in realtime so the LED was stumbling.

Unfortunately MIDI clock sends too much data to Grid to process it normally. If you have the option to debounce the MIDI clock stream, then the task becomes somewhat manageable, but large message stream processing is lacking.

Success, success!

The way I did it works although mididings’ Process() is not run in realtime, but close enough. The MIDI clock source I used was unreliable. With a fixed/corrected clock source the LED flashes in the rhythm when MIDI clock is preprocessed by the following mididings patch and turned into MIDI CC 20:

from mididings import *

config(
  backend='alsa',
  client_name='grid_clock_led',
)

halfbpq = 12
mticks = 0
led = 0
ch = 1
ctrl = 20

def divide(ev):
  global halfbpq
  global mticks
  global led
  global ch
  global ctrl

  if ev.type == SYSRT_CLOCK:
      mticks += 1
      if mticks == halfbpq:
        mticks = 0

        if led == 0:
          led = 1
        else:
          led = 0

        ev.type = CTRL
        ev.channel = ch
        ev.data1 = ctrl
        ev.data2 = led
        return ev

  if ev.type == SYSRT_START:
      mticks = 0
      led = 1
      ev.channel = ch
      ev.type = CTRL
      ev.data1 = ctrl
      ev.data2 = led
      return ev

  if ev.type == SYSRT_STOP:
      led = 0
      ev.channel = ch
      ev.type = CTRL
      ev.data1 = ctrl
      ev.data2 = led
      return ev


run(Filter(SYSRT) >> Process(divide))
1 Like