WaveSurfer Options

This is the list of parameters you can pass to var wavesurfer = WaveSurfer.create({ ... }) to create an instance of the player.

option type default description
audioRate float 1 Speed at which to play audio. Lower number is slower.
audioContext object none Use your own previously initialized AudioContext or leave blank.
audioScriptProcessor object none Use your own previously initialized ScriptProcessorNode or leave blank.
autoCenter boolean true If a scrollbar is present, center the waveform around the progress.
backend string WebAudio WebAudio or MediaElement. In most cases you don't have to set this manually. MediaElement is a fallback for unsupported browsers.
barGap number none The optional spacing between bars of the wave, if not provided will be calculated in legacy format.
barHeight number 1 Height of the waveform bars. Higher number than 1 will increase the waveform bar heights.
barWidth number none If specified, the waveform will be drawn like this: ▁ ▂ ▇ ▃ ▅ ▂
closeAudioContext boolean false Close and nullify all audio contexts when the destroy method is called.
container mixed none CSS-selector or HTML-element where the waveform should be drawn. This is the only required parameter.
cursorColor string #333 The fill color of the cursor indicating the playhead position.
cursorWidth integer 1 Measured in pixels.
fillParent boolean true Whether to fill the entire container or draw only according to minPxPerSec.
forceDecode boolean false Force decoding of audio using web audio when zooming to get a more detailed waveform.
height integer 128 The height of the waveform. Measured in pixels.
hideScrollbar boolean false Whether to hide the horizontal scrollbar when one would normally be shown.
interact boolean true Whether the mouse interaction will be enabled at initialization. You can switch this parameter at any time later on.
loopSelection boolean true (Use with regions plugin) Enable looping of selected regions.
maxCanvasWidth integer 4000 Maximum width of a single canvas in pixels, excluding a small overlap (2 * pixelRatio, rounded up to the next even integer). If the waveform is longer than this value, additional canvases will be used to render the waveform, which is useful for very large waveforms that may be too wide for browsers to draw on a single canvas. This parameter is only applicable to the MultiCanvas renderer.
mediaControls boolean false (Use with backend MediaElement) this enables the native controls for the media element.
mediaType string audio 'audio' or 'video'. Only used with backend MediaElement.
minPxPerSec integer 50 Minimum number of pixels per second of audio.
normalize boolean false If true, normalize by the maximum peak instead of 1.0.
partialRender boolean false Use the PeakCache to improve rendering speed of large waveforms.
pixelRatio integer window.devicePixelRatio Can be set to 1 for faster rendering.
plugins array [] An array of plugin definitions to register during instantiation. They will be directly initialised unless they are added with the deferInit property set to true.
progressColor string #555 The fill color of the part of the waveform behind the cursor.
removeMediaElementOnDestroy boolean true Set to false to keep the media element in the DOM when the player is destroyed. This is useful when reusing an existing media element via the loadMediaElement method.
renderer Object MultiCanvas Can be used to inject a custom renderer.
responsive boolean or float false If set to true resize the waveform, when the window is resized. This is debounced with a 100ms timeout by default. If this parameter is a number it represents that timeout.
scrollParent boolean false Whether to scroll the container with a lengthy waveform. Otherwise the waveform is shrunk to the container width (see fillParent).
skipLength float 2 Number of seconds to skip with the skipForward() and skipBackward() methods.
splitChannels boolean false Render with seperate waveforms for the channels of the audio.
waveColor string #999 The fill color of the waveform after the cursor.
xhr Object {} XHR options.
Fork me on GitHub