               state (cond
                       (or (seq? (first notes)) (vector? (first notes)))
                       (merge (compose (first notes) sequencer state)
-                             {:notes (vec-rest notes)}
-                             (if (vector? notes) {:position position} {}))
+                             {:notes (vec-rest notes)})
                       (map? (first notes))
                       (parse-state notes state)
                       (keyword? (first notes))

                          :else
                          (throw (Exception. (format "Could not parse key: %s" key))))
                        (merge state {:position
                                      (if (vector? (:notes state))
                                        (:position state)
                                        (+ (:position state) (or (:repeat-length state) (:length state))))})))
              notes (:notes state)]

         {:notes (vec-rest notes)})
        state))))

(def ^:dynamic *seq* (Sequence. Sequence/PPQ 256))
(def ^:dynamic *synth* (MidiSystem/getSynthesizer))

(defn make-sequencer [& [sequence synth]]
  (let [sequence (or sequence *seq*)
        synth (or synth *synth*)
        sequencer (MidiSystem/getSequencer)]
    (.addMetaEventListener sequencer
                           (reify MetaEventListener
                             (meta [meta]
                               (when (= (.getType meta) 0x51)
                                 (.setTempoInMPQ sequencer (float (.getInt (.put (ByteBuffer/allocate 4) (.getData meta) 1 3))))))))
    (.setSequence sequencer sequence)
    (.createTrack (.getSequence sequencer))
    (.open sequencer)
    (.open synth)
    (.setReceiver (.getTransmitter sequencer) (.getReceiver synth))
    sequencer))

(def ^:dynamic *sequencer* (make-sequencer *seq* *synth*))

(defn compose [notes & [sequencer state]]
  (let [sequencer (or sequencer *sequencer*)
