                               (.add track 
                                     (MidiEvent. (ShortMessage.
                                                  (:message-type state)
-                                                 (:ch state)
+                                                 (get-channel state)
                                                  key
                                                  value)
                                                 (+ (:position state)

                            (when (and (= (:message-type state) ShortMessage/NOTE_ON) (not (= (:tie state) :begin)))
                              (.add track (MidiEvent. (ShortMessage.
                                                       ShortMessage/NOTE_OFF
                                                       (:ch state)
                                                       key
                                                       (:release state))
                                                      (max 

  (let [args (if (empty? args) '(:cubic) args)
        interp (apply interpolate-parametric values args)
        fix-type (cond
                   (every? ratio? values) toRatio
                   (every? integer? values) int
                   :else double)]
    (map #(fix-type (interp %)) (range 0 1 (/ 1.0 num-points)))))
