 (ns klangmeister.synthesis)
 
 ; Plumbing
+
+(defn run
+  "Convert a node (actually a reader fn) into a concrete audio node by supplying context and timing."
+  [node context at duration]
+  (node context at duration))
 
 (defn destination [context at duration]
   (.-destination context))

(defn oscillator
  ([type freq detune]
   (fn [context at duration]
     (doto ((oscillator type freq) context at duration)
       (-> .-frequency (plug detune context at duration)))))
  ([type freq]
   (fn [context at duration]


(defn add [& ugens]
  (fn [context at duration]
    (let [sink (-> (gain 1.0) (run context at duration))]
      (doseq [ugen ugens]
        (-> ugen (run context at duration) (.connect sink)))
      sink)))


