   (swap! state assoc-in [:playing] nil))
 
 (defn handle [expr-str]
-  (swap! state assoc-in [:music] expr-str))
+  (swap! state assoc-in [:text] expr-str)
+  (when-let [value (evaluate expr-str)]
+    (swap! state assoc-in [:music] value)))
 
 (defn toggle []
   (if (:playing @state)
     (kill)
-    (beep)))
+    (beep (:music @state))))
 
 ;; -------------------------
 ;; Views

      #(:value %)))

(defonce context (js/window.AudioContext.))
(defn beep []
  (let [oscillator (.createOscillator context)]
    (doto oscillator
      (.connect (.-destination context))
      (-> .-frequency .-value (set! 440))
      (-> .-type (set! "square"))
      (.start 0))
    (swap! state assoc-in [:playing] oscillator)))

;; -------------------------
;; Model
(defonce state
  (atom {:music nil
         :text ""
         :playing nil}))

;; -------------------------
