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


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


(defn now [] (java.util.Date.))
(defn wha
  [xs name]
  (pprint [(now) name (count xs)])
  xs)

;;; run
(defn run []
  (let [tdl (open-audio)]
    (while true
      (let [xs (read-audio tdl N)
            spectrum (-> xs
                         (window-by mp3-window)
                         (fft) ; N wide
                         (magnitude)
                         (normalize)
                         (bin-by-octave) ; 11 wide
                         (->dBFS))
            spectrum (take 8 spectrum)]
        ;;(.update pad (render-spectrum spectrum))
        (wha spectrum "loop")))))
