                        :value 57110)
         port (read-string portstr)]
     (o/connect-external-server port)
-  ))
+    ))
+
+;; (load "midifile")
+;; (load "midi_player")
 
 (require '[overtone.inst.synth :as syn])
 

       (play metro (str->instr instr) part {:midi midiq})))))

(defn play-melody [e]
  (let [[score len] (if @melody
                      [@melody 20]
                      (make-score))
        metro (o/metronome @tempo)]
    (doseq [[instr & part] score]
      (play metro (str->instr instr) part {:midi true}))
    (o/apply-at (metro len) #(if @repetition (play-melody nil)))
    ))
  
(defn play-solo [id e]
  (let [[mel rhy _ instr] (make-part id)

(defn tuning-chooser [e]
  (let [val (value (.getSource e))]
    (case val
      "Equal"       (reset! tuning equal-temperament)
      "Pythagorean" (reset! tuning pythagorean)
      "Just"        (reset! tuning just-intonation)
      "O'Donnel"    (reset! tuning odonnel)
      "Neidhardt"   (reset! tuning neidhardt)
      "Custom"      nil ))
  ;;(println (midi->freq 60))
  )

