Help with syncing Teensy drum machine to external source via sync pulse

I have been plugging away at this for a while and cannot seem to find a solid solution.

A drum machine I am working on is set up to receive voltage pulses from an external device (such as a Korg Volca Beats). I want to be able to quickly ascertain the external source's tempo in BPM, apply it to my drum machine and have the drum machine's step sequencer in lock-step with the external device. The external source's tempo is subject to change at the user's whim.

Per Korg's documentation the Volca Beats, for example, sends a 15ms pulse and the rising edge is the trigger. Pulses are typically sent at 2 or 4 pulses per quarter note, based on configuration.

Can anyone suggest some pseudocode or logical approach to get started? I'm just stuck, mentally.

EDIT: I moved this thread to Audio Projects. Unsure of how to delete.
 
Back
Top