 //  Copyright © 2017 AudioKit. All rights reserved.
 //
 
+extension AVAudioSequencer : Collection {
+    public typealias Element = AVMusicTrack
+    public typealias Index = Int
+
+    public var startIndex: Index {
+        return 0
+    }
+
+    public var endIndex: Index {
+        return count
+    }
+
+    public subscript(index: Index) -> Element {
+        return tracks[index]
+    }
+
+    public func index(after index: Index) -> Index {
+        return index + 1
+    }
+
+    /// Rewind the sequence
+    public func rewind() {
+        currentPositionInBeats = 0
+    }
+}
+
 /// Simple MIDI Player based on Apple's AVAudioSequencer which has limited capabilities
-public class AKMIDIPlayer {
-    public var sequencer = AVAudioSequencer()
+public class AKMIDIPlayer: AVAudioSequencer {
+
     public var tempo: Double = 120.0
-
-    /// Array of AudioKit Music Tracks
-    public var tracks: [AVMusicTrack] {
-        return sequencer.tracks
-    }
 
     /// Loop control
     public var loopEnabled: Bool = false
 
     /// Sequencer Initialization
-    public init() {
-        sequencer = AVAudioSequencer(audioEngine: AudioKit.engine)
+    public override init() {
+        super.init(audioEngine: AudioKit.engine)
     }
 
     /// Initialize the sequence with a MIDI file
     ///
     /// - parameter filename: Location of the MIDI File
     ///
-    public convenience init(filename: String) {
-        self.init()
-        sequencer = AVAudioSequencer(audioEngine: AudioKit.engine)
+    public init(filename: String) {
+        super.init(audioEngine: AudioKit.engine)
         loadMIDIFile(filename)
     }
 

    /// - parameter length: Length of tracks in beats
    ///
    public func setLength(_ length: AKDuration) {
        for track in sequencer.tracks {
            track.lengthInBeats = length.beats
            track.loopRange = AVMakeBeatRange(0, length.beats)
        }

    ///
    public func sequence(from data: Data) {
        do {
            try load(from: data, options: [])
        } catch {
            AKLog("cannot load from data \(error)")
            return
