title: Where to start in order to create a MIDI sequencer / drum machine?
body: <p>I've been searching all over to find some sample code of how to use Apple's <a href="https://developer.apple.com/library/iOs/documentation/AudioToolbox/Reference/MusicSequence_Reference/index.html" rel="nofollow">MusicSequence</a> framework or anything else available. I'm an Objective C programmer, so I find the MusicSequence documentation (and also WWDC videos) rather thin and TBH, without some sample code, unusable from where I stand. </p>
  
  <p>I am able to send MIDI messages using <a href="https://github.com/petegoodliffe/PGMidi" rel="nofollow">PGMidi</a> but what I can't find is how to create events and sequence/loop them in real time, allowing the possibility to change the pattern while it's playing - classic drum machine / step sequencer style. I found some references to <a href="https://developer.apple.com/library/iOs/documentation/QuartzCore/Reference/CADisplayLink_ClassRef/index.html#//apple_ref/occ/instp/CADisplayLink/frameInterval" rel="nofollow">CADisplayLink</a> for accurate timing, but that doesn't help either (although it's being called 60 times/second - every 0.016667 sec, a BPM of 135 would need calls every 0.44444 which is not divisible by the 0.016667 frame).</p>
  
  <p>I've been looking at <a href="http://libpd.cc/" rel="nofollow">libpd</a> also and while it's possible to create a sequencer directly in <a href="http://puredata.info/" rel="nofollow">pd</a>, the recommendation is to use iOS' timing.</p>
  
  <p>Everything else I found on GitHub is more than two years old and usually comes with many compiler errors.</p>