   (m :bpm 140) ; => set bpm to 140"
   [bpm]
   (let [start (atom (now))
-        bpm   (atom bpm)]
-    (Metronome. start bpm)))
+        bar-start (atom @start)
+        bpm   (atom bpm)
+        bpb   (atom 4)]
+    (Metronome. start bar-start bpm bpb)))
 
 ;== Grooves
 ;

    (let [new-start (- (now) (* start-beat (metro-tick metro)))]
      (reset! start new-start)
      new-start))
  (metro-tick  [metro] (beat-ms 1 @bpm))
  (metro-beat  [metro] (inc (long (/ (- (now) @start) (metro-tick metro)))))
  (metro-beat  [metro b] (+ (* b (metro-tick metro)) @start))
  (metro-bpm   [metro] @bpm)
  (metro-bpm   [metro new-bpm]
    (let [cur-beat (metro-beat metro)
          new-tick (beat-ms 1 new-bpm)
          new-start (- (metro-beat metro cur-beat) (* new-tick cur-beat))]
      (reset! start new-start)
      (reset! bpm new-bpm))
    [:bpm new-bpm])

  clojure.lang.ILookup
  (valAt [this key] (.valAt this key nil))

  with no arguments to get the next beat number, or pass it a beat number
  to get the timestamp to play a note at that beat.

  Metronome also works with bars. Set the number of beats per bar using
  metro-bpb (defaults to 4). metro-bar returns a timestamp that can be used
  to play a note relative to a specified bar.

  (def m (metronome 128))
  (m)          ; => <next beat number>
  (m 200)      ; => <timestamp of beat 200>
