                      :finished?   true
                      :sample-rate sample-rate
                      :input-data  input-data
-                     :chunks      (apply concat (js->clj chunks))))))
+                     :chunks      (js->clj chunks)))))
     (.start source)))
 
-(defn plot-chunker-test
+(defn chunker-test
   [state]
   (let [{:keys [processing?
                 finished?
                 sample-rate
                 input-data
-                chunks]} @state]
+                chunks]} @state
+        combined-chunks  (apply concat chunks)]
     (cond
       finished?   (plot-buffers (count input-data)
-                                (str "Input Data "
-                                     "(" (count input-data) " samples)")
+                                (gstring/format "Input Data (%d samples)"
+                                                (count input-data))
                                 input-data
-                                (str "Concatenated Chunks "
-                                     "(" (count chunks) " samples)")
-                                chunks)
+                                (gstring/format "%d Chunks (%d samples)"
+                                                (count chunks)
+                                                (count combined-chunks))
+                                combined-chunks)
       processing? (html [:p "Processing..."])
       :else       (html [:button {:on-click #(run-test state)}
                          "Run test"]))))

   concatenating all chunks, which, if the audio chunker works correctly,
   should be exactly the same."
  (fn [state owner]
    (plot-chunker-test state))
  {:processing? false
   :finished?   false
   :chunk-size  4410
   :chunks      []
   :input-data  []
   :sample-rate 0
   :data-fn     (fn [sample-rate]
                  (linear-distribution [-1.0 1.0] 32768))})


(ns audio-utils.devcards.audio-chunker
  (:require-macros [cljs.core.async.macros :refer [go]])
  (:require [devcards.core :refer-macros [defcard deftest dom-node]]
            [goog.string :as gstring]
            [goog.string.format]
            [sablono.core :refer-macros [html]]
            [audio-utils.audio-chunker :as c]
            [audio-utils.web-audio :as a]
