 (defn now [] (java.util.Date.))
 (defn wha
   [xs name]
-  (pprint (str (now) ": " name " " (take 3 xs)))
+  (pprint [(now) name (count xs)])
   xs)
 
 ;;; run
 (defn run []
   (let [tdl (open-audio)]
-    (loop [block1 (read-audio tdl N)]
-      (let [block2 (read-audio tdl N)
-            xs (concat block1 block2)
+    (while true
+      (let [xs (read-audio tdl N)
             spectrum (-> xs
                          (window-by mp3-window)
-                         (mdct) ; N wide
+                         (fft) ; N wide
+                         (magnitude)
                          (normalize)
                          (bin-by-octave) ; 11 wide
                          (->dBFS))
             spectrum (take 8 spectrum)]
         ;;(.update pad (render-spectrum spectrum))
-        (wha spectrum "oof")
-        (recur block2)))))
+        (wha spectrum "loop")))))

  [coll]
  (map dBFS coll))

;; a companion to the mdct, length is 2N
(def mp3-window
  (let [NN (* 2 N)
        pi2n (/ Math/PI NN)]
    (map #(Math/sin (* pi2n
                       (+ % (/ 2))))
         (range NN))))

(defn window-by
  [block window]


(defn open-audio
  []
  (let [af (AudioFormat. 44100 8 1 true false)
        tdl (AudioSystem/getTargetDataLine af)]
    (.open tdl af)
    (.start tdl)
    tdl))

