         pitch (nth (cycle lh-pitches) idx)]
     (if (sequential? pitch)
       (doseq [p pitch]
-        (sampled-piano p vol))
-      (sampled-piano pitch vol))))
+        (sampled-piano p (vol-mul vol)))
+      (sampled-piano pitch (vol-mul vol)))))
 
 (defonce m (poly/init "/dev/tty.usbserial-m64-0790"))
 
-
 (poly/on-press m (fn [x y s]
-                   (if (= 7 x)
-                     (reset-pos)
-                     (do
-                       (if (< 5 y)
-                         (play-next-rh (+ (rand-int 5) (* 12 (+ x 4))))
-                         (play-next-lh (+ (rand-int 5) (* 12 (+ x 4)))))
-                       (poly/led-on m x y)))
-
-                   (println [x y])))
-
-(poly/on-release m (fn [x y s]
-                     (poly/led-off m x y)))
+                   (match [x y]
+                          [7 _] (reset-pos)
+                          [_ 0] (play-next-lh (+ (rand-int 5) (* 12 (+ x 4))))
+                          [_ 7] (play-next-rh (+ (rand-int 5) (* 12 (+ x 4)))))))
 
 ;;(poly/remove-all-callbacks m)
-;;(poly/disconnect OCOC)m
+;;(poly/disconnect m)

(ns examples.satie
  (:use [overtone.live])
  (:require [polynome.core :as poly]))

;;Erik Satie Gnossienne No. 1

;;Piano samples downloaded from: http://blackhole12.newgrounds.com/news/post/92464
(defonce piano-samples (load-samples "~/Desktop/samples/MIS_Stereo_Piano/Piano/*LOUD*"))


(defn matching-notes
  [note]
  (filter #(if-let [n (match-note (:name %))]
             (= note (:midi-note n)))
          piano-samples))

(defn sampled-piano
  ([note] (sampled-piano note 1))
  ([note vol]
     (if-let [sample (first (matching-notes note))]
       (stereo-player sample :vol (* 0.01 vol)))))

(def phrase1a [:iii :v :iv# :iii :iii :ii# :iii :ii#])
(def phrase1b [:iii :v :iv# :iii :v# :vi :v# :vi])
(def phrase1c [:iii :v :iv# :iii :iii :ii# :i :vii- :vi- :vii- :vi- :vii- :i :vii- :vii- :vi-])

                               phrase1-bass                            ;;U
                               ))

(def lh-pitches (degrees->pitches left-hand-degrees :major :Ab4))
(def rh-pitches (degrees->pitches right-hand-degrees :major :Ab4))

(def cur-pitch-rh (atom -1))
(def cur-pitch-lh (atom -1))
