 (ns examples.extemp-piano
   (:use [overtone.live]
-        [overtone.inst synth]))
+        [overtone.inst synth sampled-piano]))
 
 ;; This example has been translated from the Extempore code demonstrated in
 ;; http://vimeo.com/21956071 (found around the 10 minute mark)

(defn beat-loop
  [metro beat chord-idx]
  (let [[tonic chord-name] (choose (seq (nth chord-prog chord-idx)))
        nxt-chord-idx     (mod (inc chord-idx) (count chord-prog))]
    (dorun
     (map (fn [note offset]
            (at (metro (+ beat offset)) (instrument note)))
          (rand-chord (+ root tonic) chord-name (count beat-offsets) (cosr beat range-variation  max-range range-period) )
          beat-offsets))
    (apply-at (metro (inc beat)) #'beat-loop [metro (inc beat) nxt-chord-idx])))
(stop)

;;start the music:
(beat-loop metro (metro) 0)

;;                  (random '(2 7 10))
;;                  (random '(0 8))))))

(def chord-prog
  [#{[2 :minor7] [7 :minor7] [10 :major7]}
   #{[0 :minor7] [8 :major7]}])

(def beat-offsets [0 0.1 0.2 1/3  0.7 0.9])

(def metro (metronome 20))
;;(metro :bpm 30)

(def root 40)
(def max-range 35)
