         (swap! score conj part)))
     [@score, totaltime]))
 
+(defn play-score
+  ([score] (play-score true))
+  ([score midiq]
+   (let [metro (o/metronome @tempo)]
+     (doseq [[instr & part] score]
+       (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)
-        endseq (atom '())]
+        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)))

                                     :listen [:action melody-chooser])
                           ])))

(config! control-frame :on-close :exit)

(defn -main [& args]
  (-> control-frame pack! show!)

                           (button :id :newPanel
                                   :text "New Panel"
                                   :listen [:action new-panel])
                           (button :id :monoChord
                                   :text "Monochord"
                                   :listen [:action new-mono])
                           (button :id :saveButt
                                   :text "Save"
                                   :listen [:action save-pattern])
