        (condp = c
          c-orientation-change (recur (update-size instrument canvas-id))
          c-touch (recur (fire-touch-data-on-instrument instrument data))
-         (recur (step-time instrument))))))
-  )
+         (recur (step-time instrument frame-delay)))))))

     :notes ()
     :w 0 :h 0 :sound-ready false
     :px-per-ms 0.04
     :start start
     :previous-time start
     :playhead start}))

(defn add-synths-to-instrument

                 (-> instrument :piano-keys keys))
    :sound-ready true))

(defn play-piano-key
  [instrument freq]
  (println "play")
  (.play (.bang (get-in instrument [:piano-keys freq :synth])))
  (assoc-in instrument [:piano-keys freq :on?] true))

(defn stop-piano-key
  [instrument freq]
  (if (get-in instrument [:piano-keys freq :on?])
    (do
      (println "stop" (get-in instrument [:piano-keys freq :synth]))
      (.release (get-in instrument [:piano-keys freq :synth]))
      (assoc-in instrument [:piano-keys freq :on?] false))
    instrument))

(defn touch-data->touches [touch-data]
  (let [event (.-event_ touch-data)
        touches (js->clj (.-changedTouches event) :keywordize-keys true)]
    (map (fn [x] {:type (.-type event)
                  :touch-id (:identifier x)
                  :position {:x (:clientX x) :y (:clientY x)}
                  :time (.-timeStamp event)})
         (for [x (range (:length touches))] ((keyword (str x)) touches)))))

(defn touch->freq
  [instrument touch]
  (touch->note (get-in touch [:position :x])
               instrument))

(defn maybe-init-synths
  [instrument]
