 (defn oscillator
   [type freq]
   (fn [context at duration]
-    (section
+    (generator
       (doto (.createOscillator context)
         (-> .-frequency .-value (set! 0))
         (-> .-frequency (plug freq context at duration))

          data (.getChannelData buffer 0)]
      (doseq [i (range sample-rate)]
        (aset data i (generate-bit!)))
      (section
        (doto (.createBufferSource context)
          (-> .-buffer (set! buffer))
          (.start at))))))

(ns klangmeister.sound.synthesis)

; Definitions

(defn section
  ([input output] {:input input :output output})
  ([singleton] (section singleton singleton)))

(defn generator
  "A graph of synthesis nodes without an input, so another graph can't connect to it."
  [node]
  (section nil node))

(defn sink
  "A graph of synthesis nodes without an output, so it can't connect to another graph."
  [node]
  (section node nil))

; Plumbing

