   (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)))

(defn home-page []
  [:div [:h1 "Welcome to Leipzig Live!"]
   [:div [:input {:type "text"
                  :value (:text @state)
                  :on-change #(-> % .-target .-value handle)}]
    [:button {:on-click toggle} "Start/stop"]]
   [:div
    (:music @state)]])

(defn current-page []
  [:div [(session/get :current-page)]])
