This is outdated documentation for wavesurfer.js v6!

Please refer to the new documentaton and examples.

Microphone plugin

Visualizes audio input from a microphone in wavesurfer.js instances.

Quick start

  1. add the Microphone plugin script tag
  2. create a WaveSurfer instance
  3. create a Microphone instance
  4. control the Microphone using the start, stopDevice, play, pause, stop and togglePlay methods

Options

Name Required Default Description
wavesurfer yes A WaveSurfer instance.
bufferSize no 4096 The buffer size in units of sample-frames. If specified, the bufferSize must be one of the following values: 256, 512, 1024, 2048, 4096, 8192, 16384.
numberOfInputChannels no 1 Integer specifying the number of channels for this node's input. Values of up to 32 are supported.
numberOfOutputChannels no 1 Integer specifying the number of channels for this node's output. Values of up to 32 are supported.

Events

Name Description
deviceReady Invoked when the device is ready to use. Callback will receive a LocalMediaStream object that contains the microphone stream.
deviceError Invoked when the user doesn't allow the browser to access the microphone. Callback will receive a (string) error code.