   "Produces a serialized representation of the synth definition understood
   by SuperCollider, and returns it in a byte array."
   [sdef]
+  (ensure-synthdef! sdef)
   (spec-write-bytes synthdef-file-spec
     (cond
       (synthdef? sdef) (synthdef-file sdef)

  synthdef loading is delayed until the server has succesfully
  connected."
  [sdef]
  (assert (synthdef? sdef))
  (dosync (alter loaded-synthdefs* assoc (:name sdef) sdef))

  (when (server-connected?)

  "Returns the set of control parameter name/default-value pairs for a synth
  definition."
  [sdef]
  (ensure-synthdef! sdef)
  (let [names (map #(keyword (:name %1)) (:pnames sdef))
        vals (:params sdef)]
  (apply hash-map (interleave names vals))))
