 
   (componentDidMount [this]
     (let [{:keys [on-change]
-           :or {on-change identity}} (om/props this)]
+           :or   {on-change identity}} (om/props this)]
       (go-loop []
         (when-let [v (<! (debounce (om/get-state this :chan) 300))]
           (on-change (js/parseInt v))

(om/defui ChordMetronome
  Object
  (initLocalState [_]
    {:note nil
     :interval 60})

  (render [this]

          (dom/button #js {:onClick #(om/update-state! this assoc :note n)
                           :style   (if (= n note)
                                      #js {:background "#0c0"})
                           :key     n}
            (or n "Mute")))
        (debounce-slider {:react-key "debounce" :min 30 :max 320 :value interval :on-change #(om/update-state! this assoc :interval %)})
        #_(let [i 1.5]
            (sound-pattern {:react-key "pattern" :pattern (flatten [(chord "C3") i
                                                                    (chord "G3") i
                                                                    "A3" "C4" "E4" i
                                                                    (chord "F3") i])}))
        (if note
          (sound-pattern {:react-key "pattern" :pattern (tick-pattern note (/ 60 interval))}))))))

