(edna->data-uri content)

(edna->data-uri content opts)

Turns the edna content into a data URI for use in browsers. The opts map can contain: :soundbank - A javax.sound.midi.Soundbank object, or nil to use the JVM's built-in one (optional, defaults to a soundbank included in this library) :format - A javax.sound.sampled.AudioFormat object (optional, defaults to one with 44100 Hz) Note: If you want to use the sound font installed on your system, rather than the one built into edna, include `:soundbank nil` in your opts map.

Source

(defn edna->data-uri "Turns the edna content into a data URI for use in browsers. The opts map can contain: :soundbank - A javax.sound.midi.Soundbank object, or nil to use the JVM's built-in one (optional, defaults to a soundbank included in this library) :format - A javax.sound.sampled.AudioFormat object (optional, defaults to one with 44100 Hz) Note: If you want to use the sound font installed on your system, rather than the one built into edna, include `:soundbank nil` in your opts map." ([content] (edna->data-uri content {})) ([content opts] (str "data:audio/mp3;base64," (-> (binding [*out* (java.io.StringWriter.)] (->> (select-keys opts [:soundbank :format]) (merge {:type :mp3}) (export! content))) .toByteArray (base64/encode) (String. "UTF-8")))))