MIDI clock program
2007-12-01 by djbrow54
I just picked up an old Alesis HR-16 drum machine. I thought it would be fun to synchronize with my MIDI bass pedals, which is basically an AtomPro24 running a modified version of my arpeggiator program. Since it includes my full MIDI command parser, I only needed to add a few lines of code for the MIDI start, stop, and clock routines. I am now controlling my MIDI bass pedal arpeggiator by the internal clock unless MIDI clock is being received in which case it synchronizes to it. Most of this code is in my CVS-PSIM template, so I created a separate PSIM program that generates an AUX jack clock output from MIDI clock. I use MIDI start and stop to enable and disable the clock, turn on the appropriate stop or run LED, and blink the run LED with the clock output. Since I have a 2x8 display on my PSIM, I count the number of MIDI clocks during 1 second time period as determined by 1000 1mS interrupts, and display the BPM value. This took probably 30 lines of code to add to my template since all of the MIDI code is there. This way I can synchronize and run both my MIDI bass pedal arpeggiator and my 16 step sequencer from the drum machine. Kind of an expensive MIDI clock extractor but it works. It would be easy to create a phase of clock outputs since there are 24 MIDI clocks to a quarter note. I'll upload this program to my site next time I update it. It is fully compatible with the CVS. Dave