This plugin requires Jussi Kalliokoski's terrific PCMData.js library, which you can find in original or minified form here.
var rec = new Recorder(source [, config])
Creates a recorder instance.
- source - The node whose output you wish to capture
- config - (optional) A configuration object (see config section below)
- bufferLen - The length of the buffer that the internal JavaScriptNode uses to capture the audio. Can be tweaked if experiencing performance issues. Defaults to 4096.
- callback - A default callback to be used with
exportWAV
. - type - The type of the Blob generated by
exportWAV
. Defaults to 'audio/wav'. To force a download, try setting this to 'application/octet-stream'.
rec.record()
rec.stop()
Pretty self-explanatory... record will begin capturing audio and stop will cease capturing audio. Subsequent calls to record will add to the current recording.
rec.clear()
This will clear the recording.
rec.exportWAV([callback] [, type])
This will generate a Blob object containing the recording in WAV format. The callback will be called with the Blob as its sole argument. If a callback is not specified, the default callback (as defined in the config) will be used. If no default has been set, an error will be thrown.
In addition, you may specify the type of Blob to be returned (defaults to 'audio/wav').
rec.configure(config)
This will set the configuration for Recorder by passing in a config object.