             args)))
 
 (defmethod print-method SCUGen [ug w]
-  (.write w (str "#<sc-ugen: " (:name ug) " with " (count-ugen-args ug) " internal sc-ugens>")))
+  (.write w (str "#<sc-ugen: " (overtone-ugen-name (:name ug)) (:rate-name ug) " [" (count-ugen-args ug) "]>")))
 
 (defrecord ControlProxy [name value rate rate-name])
 (derive ControlProxy ::sc-ugen)

(defn sc-ugen? [obj] (isa? (type obj) ::sc-ugen))

(defn sc-ugen
  "Create a new SCUGen instance"
  [id name rate rate-name special args n-outputs]
  (SCUGen. id name rate rate-name special args n-outputs))

(defn count-ugen-args
  "Count the number of ugens in the args of ug (and their args recursively)"

(defn control-proxy
  "Create a new control proxy with the specified name, value and rate. Rate
  defaults to :kr. Specifically handles :tr which is really a TrigControl
  ugen at :kr. Throws an error if any of the args are nil."
  ([name value] (control-proxy name value :kr))
  ([name value rate-name]
     (let [rate (if (= :tr)
                  (:kr RATES)
                  (rate-name RATES))]
       (if (or (nil? name)
               (nil? value)
               (nil? rate)
               (nil? rate-name))
         (throw (IllegalArgumentException. (str "Attempted to create a ControlProxy with nil args. Got " [name value rate rate-name])))
         (ControlProxy. name value rate rate-name)))))

(defrecord OutputProxy [ugen rate rate-name index])
(derive OutputProxy ::sc-ugen)

(defn output-proxy
  "Create a new output proxy. Throws an error if any of the args are nil."
  [ugen index]
  (let [rate (:rate ugen)
        rate-name (REVERSE-RATES (:rate ugen))]
    (if (or (nil? ugen)
            (nil? rate)
            (nil? rate-name)
            (nil? index))
      (throw (IllegalArgumentException. (str "Attempted to create an OutputProxy with nil args. Got " [ugen rate rate-name index])))
      (OutputProxy. ugen rate rate-name index))))


(defn control-proxy? [obj] (= ControlProxy (type obj)))
