   [osc-model {:keys [pitch duration volume]}]
   (let [{:keys [osc-node gain-node] :as osc-impl} (osc* osc-model)]
     (.start osc-node 0)
+    (alter-var-root #'*active-oscs* conj osc-node)
 
     (when pitch 
       (freq osc-node pitch))

  (let [constructor (or js/window.AudioContext
                        js/window.webkitAudioContext)]
    (constructor.)))

(defn osc 
  "Models the state of an oscillator.


    (if duration
      (do
        ; *** see below ***
        (js/setTimeout #(stop-osc osc-impl) duration)
        osc-model)
      (update osc-model :osc-nodes (fnil conj #{}) osc-impl))))

; this fn now only works for osc-impl
; need a new fn that works for osc-model (which now has a set of osc-impls) 
; or maybe make this a multimethod that works for both
(defn stop-osc
  "Silences and stops a currently playing oscillator."
  [{:keys [osc-node gain-node] :as osc-model-or-impl}]
  (silence-ramp gain-node)
  (js/setTimeout #(do
                    (.stop osc-node)
                    (alter-var-root #'*active-oscs* disj osc-node)) 1000))

(comment "
  TODO: 
