             print("could not start avSeq")
         }
     }
-    public func stop(){
+    
+    /// Stop the sequence
+    public func stop() {
 //        MusicPlayerStop(musicPlayer)
         avSeq.stop()
     }
-    public func rewind(){
+    
+    /// Rewind the sequence
+    public func rewind() {
 //        MusicPlayerSetTime(musicPlayer, 0)
         avSeq.currentPositionInBeats = 0
     }
     
-    public func setGlobalMidiOutput(midiEndpoint:MIDIEndpointRef){
+    /// Set the midi output for all tracks
+    public func setGlobalMidiOutput(midiEndpoint: MIDIEndpointRef) {
 //        for trackInd in tracks{
 //            MusicTrackSetDestMIDIEndpoint(trackInd.internalMusicTrack, midiEndpoint)
 //        }

        return Double(length)
    }
    
    public func play(){
//        MusicPlayerStart(musicPlayer)
        do{
            try avSeq.start()

 */
public class AKSequencer {
    
    /// Music sequence
    public var sequence:MusicSequence = nil
    
    /// Pointer to Music Sequence
    public var sequencePointer:UnsafeMutablePointer<MusicSequence>
    
    /// AVAudioSequencer
    public var avSeq = AVAudioSequencer()
    
    /// Array of AudioKit Music Tracks
    public var tracks:[AKMusicTrack] = []
    
    /// Array of AVMusicTracks
    public var rawTracks:[AVMusicTrack] {
        return avSeq.tracks
    }
    
    /// Musci Player
    var musicPlayer:MusicPlayer = nil
    
    /// Loop control
    public var loopEnabled:Bool = false
    
    /// Sequencer Initialization
    public init() {
        NewMusicSequence(&sequence)
        sequencePointer = UnsafeMutablePointer<MusicSequence>(sequence)
