 
 (defn step-time
   [instrument delta]
-  (if (not (instrument :scroll-touch-id))
-    (assoc instrument :playhead (+ (instrument :playhead) delta))
-    instrument))
+  (if (scrolling? instrument)
+    instrument
+    (assoc instrument :playhead (+ (instrument :playhead) delta))))
 
 (defn tick
   [instrument delta]
-  (step-time instrument delta))
+  (-> instrument
+      (step-time delta)
+      (scroll delta)))
 
 (prevent-scrolling)
 (set-up-web-audio-on-first-touch)

(defmethod handle-touch "touchmove"
  [{touch-id :touch-id :as t} touches out-c]
  (go
   (if (scroll? touches t)
     (let [{{x1 :x y1 :y} :position} (get touches touch-id)
           {{x2 :x y2 :y} :position} t
           scroll (-> t (assoc :x-distance (- x1 x2)) (assoc :y-distance (- y1 y2)))]

  [{x1 :x y1 :y} {x2 :x y2 :y}]
  (.sqrt js/Math (+ (.pow js/Math (- x2 x1) 2) (.pow js/Math (- y2 y1) 2))))

(defn finger-push
  [{touch-id :touch-id touch-y-distance :y-distance} instrument]
  (-> instrument
      (assoc-in [:scroll :distance] touch-y-distance)
      (assoc-in [:scroll :touch-id] touch-id)))

(defn stop-finger-push
  [{touch-y-distance :y-distance} instrument]
  (-> instrument
      (assoc-in [:scroll :distance] 0)
      (assoc-in [:scroll :touch-id] nil)))

(defn stop-scroll
  [touch instrument]
  (assoc-in instrument [:scroll :speed] 0))

(defn scroll
  [{{distance :distance speed :speed friction :friction} :scroll
    playhead :playhead :as instrument}
   delta]
  (let [pre-zeno-speed (* (+ speed distance)
                          (if (finger-pushing? instrument) 1 friction))
        speed (if (< (.abs js/Math pre-zeno-speed) 1) 0 pre-zeno-speed)]
    (-> instrument
        (assoc :playhead (+ playhead speed))
        (assoc-in [:scroll :speed] speed))))

(defn fire-touch-hold-on-instrument
  [touch instrument]
  (if (scrolling? instrument)
    (stop-scroll touch instrument)
    (start-note touch instrument)))

(defn fire-touch-on-instrument
  [touch instrument]
  (condp = (touch :type)
    "touchstart" (fire-touch-hold-on-instrument touch instrument)
    "touchmove" (finger-push touch instrument)
    "touchend" (->> instrument
                   (end-notes touch)
                   (stop-finger-push touch))))

(defn update-size [instrument canvas-id]
  (let [{w :w h :h :as window-size} (util/get-window-size)]
