         (-> .-buffer (set! (buffer generate-bit! context (+ duration 1.0))))))))
 
 (def reverb
+  "Crude reverb."
   (let [duration 5
         decay 3
         sample-rate 44100

  [synth context at duration]
  (synth context at duration))

(defn destination [context at duration]
  (sink (.-destination context)))

(defn plug [param input context at duration]

        corners)
      (subgraph audio-node))))

(defn adshr
  "An ADSR envelope that also lets you specify the hold duration."
  [attack decay sustain hold release]
  (envelope [attack 1.0] [decay sustain] [hold sustain] [release 0]))

(defn adsr
  "A four-stage envelope."
  [attack decay sustain release]
  (fn [context at duration]
    (let [remainder (- duration attack decay sustain)
          hold (max 0.0 remainder)
          node (adshr attack decay sustain hold release)]
      (-> node (run-with context at duration)))))

(defn percussive
  "A simple envelope."
  [attack decay]
  (envelope [attack 1.0] [decay 0.0]))


