cracked-machine / BassStationSequencerSW

Firmware for Novation BassStation HW Sequencer
MIT License
0 stars 1 forks source link

MIDI heartbeat and sequencer timing sync problems #11

Closed cracked-machine closed 2 years ago

cracked-machine commented 2 years ago

Both MIDI heartbeat and sequencer step execution need to run in synchronization but at different frequencies. i.e. The MIDI timer needs to run faster. Therefore they are triggered by seperate timers. However there are drift issues with the synchronization if we simply set the timer frequency manually. A better solution is needed:

  1. master/slave sync No good, the slave timer must run at the same freq as the master.
  2. Input compare. Only works with own duty? Maybe a 2nd channel could run a faster duty cycle and could trigger a second timer?
  3. repetition counter. MIDI timer could wait n repetitions before triggering the sequencer timer?
cracked-machine commented 2 years ago

Solution was to have one timer in SequenceManager. The ISR would count 0->12. Every count would send a MIDI clock message, but only when reaching 12 would the Pattern cursor be incremented.

e0813dfe3eba70da7c41fa62eb7fcb1d4a5ce861