Close

MIDI and Sync

A project log for DrumKid: aleatoric drum machine

A lo-fi digital drum machine which uses randomness to create unpredictable beats. Runs on Arduino, with audio provided by the Mozzi library.

matt-bradshawMatt Bradshaw 10/14/2019 at 15:100 Comments

After getting lots of feedback, I'm attempting to add MIDI to DrumKid. Many people have expressed a hope that DrumKid would feature the ability to synchronise with other instruments, and I've decided that MIDI is the best way to do this, because this also gives the option of using DrumKid as a MIDI controller, thereby greatly expanding its capabilities.

(For the uninitiated, MIDI stands for "musical instrument digital interface", and is a type of serial connection which allows musical instruments to send data to each other, such as notes, timing, and other controls.)

Outputting MIDI note data from DrumKid was very easy, and instantly convinced me that MIDI was a vital feature which had been missing all along - I was suddenly able to produce a much wider variety of sounds by triggering other drum machines' samples. However, generating synchronisation data has proven much harder. The MIDI "clock" standard requires a byte of serial data to be sent 24 times per quarter note. Had I thought about this from the outset, I probably wouldn't have designed my code around an arbitrary division of 16 pulses per quarter note, because these two divisions are basically incompatible! I was able to get my Korg synth to sync up with DrumKid, but only at lower tempos, and not with any great reliability.

After several hours of trying to fudge the code, I decided it's time for a major rewrite. The code had become bloated and messy, and I was pushing right up against the RAM limit anyway. Now that I'm 90% sure that DrumKid will feature MIDI, I'm going to incorporate it properly, rather than as an afterthought.

The next GitHub update might be a pretty major one!

Discussions