     ;;(live-sequencer (now) ms-per-pattern *beats)
     ;; (live-sequencer (metro (inc (metro))) ms-per-pattern *beats))
     (live-sequencer (metro (next-beat (metro) 0 beat-per-pattern)) (* 16 ms-per-pattern) *beats16))
+  (let [ms-per-pattern (* 1000 dur-per-pattern)]
+    ;;(live-sequencer (now) ms-per-pattern *beats)
+    ;; (live-sequencer (metro (inc (metro))) ms-per-pattern *beats))
+    (start-live-sequencer (metro (next-beat (metro) 0 beat-per-pattern)) (* 16 ms-per-pattern) *beats16))
+  (print @*live-sequencer-states)
+  (swap! *live-sequencer-states assoc 3 false)
   (reset! *beats16 beats16))
 
 

          (schedule-pattern beat-t beat-sep-t sound beat-info)
          (at beat-t (when beat-info (apply sound (flatten1 beat-info)))))))))

(defn live-sequencer
  [curr-t pat-dur live-patterns]
  (doseq [[sound pattern] @live-patterns]
    (schedule-pattern curr-t pat-dur sound pattern))
  (let [new-t (+ curr-t pat-dur)]
    (apply-by new-t #'live-sequencer [new-t pat-dur live-patterns])))

(def a {:rate 2 :amp 0.1 :time-scale-max 5})
(def a {:rate 100 :amp 0.4 :time-scale-max 5})
(def b {:pan -1 :freq 1000})
(def c {:freq 25000 :amp 0.2})

  (let [ms-per-pattern (* 1000 dur-per-pattern)]
    ;;(live-sequencer (now) ms-per-pattern *beats)
    ;; (live-sequencer (metro (inc (metro))) ms-per-pattern *beats))
    (start-live-sequencer (metro (next-beat (metro) 0 beat-per-pattern)) ms-per-pattern *beats))
  (init-latchbell-mod (:rate @latchbell-arg))
  (apply-by (metro (- (next-beat (metro) 0 (* 8 beat-per-pattern)) 1/16))
            #'swap! [*beats assoc laserbeam [d _ _ [_ d d] (vec (repeat 64 0.5)) _ _ d _ _ d _ b _ _ [d d d]]])

  (apply-by (metro (- (next-beat (metro) 0 (* 8 beat-per-pattern)) 1/16))
            #'init-latchbell-mod [(:rate @latchbell-arg)])
  (apply-by (metro (- (next-beat (metro) 0 (* 8 beat-per-pattern)) 1/16))
            #'swap! [*beats assoc latchbell (vec (repeat 24 a))])

  (swap! *beats assoc laserbeam [d _ _ [d d] (vec (repeat 64 0.8)) _ _ d _ _ d _ b _ _ [d d d]])
