MUFF WIGGLER Forum Index
 FAQ & Terms of UseFAQ & Terms Of Use   Wiggler RadioMW Radio   Muff Wiggler TwitterTwitter   Support the site @ PatreonPatreon 
 SearchSearch   RegisterSign up   Log inLog in 
WIGGLING 'LITE' IN GUEST MODE

MIDI to trigger DIY eurorack module
MUFF WIGGLER Forum Index -> Music Tech DIY  
Author MIDI to trigger DIY eurorack module
Picard
For live performance I need to sync the eurorack to a master MIDI clock. To make trigger pulses available for 16th, 8th, 4th, half, and full notes I built a small straight forward module based on a Atmega328. It is just listening to the MIDI clock messages (0xF8) and counting 16th notes internally.

It was important to also evaluate the MIDI START message (0xFA) to reset the internal 16th counter to sync all triggers to the start of a bar.

Look at this:


Picard
The firmware is Arduino-based and uses event handlers for the clock messages.
micros() is used to get trigger puls widths of 10 ms.

Code:

#include <MIDI.h>

MIDI_CREATE_DEFAULT_INSTANCE();

static const unsigned b[] = {PD3, PD2, PD4, PD5, PD6};
static const byte m[] = {96, 48, 24, 12, 6};
byte a[] = {0, 0, 0, 0, 0};
unsigned long t[] = {0, 0, 0, 0, 0};
byte c = 96;
byte i;

void handleClock(void)
{
  for (i = 0; i <= 4; i++)
    if ((c % m[i]) == 0) {
      digitalWrite(b[i], HIGH);
      a[i] = 1;
      t[i] = micros();
    }
  c--;
  if (c == 0) c = 96;
}
void handleStart(void)
{
  c = 96;
}
void handleContinue(void)
{
 
}
void handleStop(void)
{

}

void setup()
{
  for (i = 0; i <= 4; i++) pinMode(b[i], OUTPUT);

  MIDI.setHandleClock(handleClock);
  MIDI.setHandleStart(handleStart);
  MIDI.setHandleContinue(handleContinue);
  MIDI.setHandleStop(handleStop);
  MIDI.begin(MIDI_CHANNEL_OMNI);
  MIDI.turnThruOff();
}

void loop()
{
  MIDI.read();
  for (i = 0; i <= 4; i++)
    if (a[i] == 1)
      if ((micros() - t[i]) > 10000) {
        digitalWrite(b[i], LOW);
        a[i] = 0;
      }
}
Bjarne
Thanks for sharing! This looks like a nice schematic for breadboarding a minimalistic midi to drum trigger gadget as well.
Cheers
aabbcc
Looks awesome! Any chance the code code be modified to support accent/velocity changes over midi?
devinw1
Nice! Simple but effective! thumbs up
cackland
aabbcc wrote:
Looks awesome! Any chance the code code be modified to support accent/velocity changes over midi?


Yes, this is easily done.
MUFF WIGGLER Forum Index -> Music Tech DIY  
Page 1 of 1
Powered by phpBB © phpBB Group