 ;;    - get a unique set of channels from the intersecting notes
 ;;    - choose to play on the next available channel on the channel list
 ;;    - if no channels are available, play on the next channel/least used channel
+;;   fix envelopes
 ;;   :time-signature [4 4]
 ;;   add shortcuts for intervals, chords, key signatures, dynamics
 ;;   DAW recording interface for capturing param values / performances

                                     :midi-message nil})))
        state))))

(defn play [& [notes sequencer state]]
  (let [sequencer (or sequencer *sequencer*)
        state (compose (or notes '()) sequencer state)]
    (when (nil? notes)

(defn ratio [value]
  (clojure.lang.Numbers/toRatio value))

(defn env [num-points values & [type options]]
  (let [values (vec values)
        type (or type (if (= 2 (count values)) :linear :cubic))
        interp (apply interpolate-parametric values type :range [0 (- num-points 1)] options)
        fix-type (cond
                   (every? ratio? values) ratio
                   (every? integer? values) int
                   :else double)]
    (map #(fix-type (interp %)) (range num-points))))

(defn vec-rest [coll]
  (if (vector? coll)
