Home Reference Source
import SpectrogramPlugin from 'wavesurfer.js/src/plugin/spectrogram.js'
public class | source

SpectrogramPlugin

Extends:

Observer → SpectrogramPlugin

Implements:

Render a spectrogram visualisation of the audio.

Example:

// es6
import SpectrogramPlugin from 'wavesurfer.spectrogram.js';

// commonjs
var SpectrogramPlugin = require('wavesurfer.spectrogram.js');

// if you are using <script> tags
var SpectrogramPlugin = window.WaveSurfer.spectrogram;

// ... initialising wavesurfer with the plugin
var wavesurfer = WaveSurfer.create({
  // wavesurfer options ...
  plugins: [
    SpectrogramPlugin.create({
      // plugin options ...
    })
  ]
});

Static Method Summary

Static Public Methods
public static

Spectrogram plugin definition factory

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

alpha: *

public
public
public
public

height: *

public
public

params: *

public
public
public

util: *

public
public

width: *

public
public

wrapper: *

Method Summary

Public Methods
public
public
public
public

drawSpectrogram(frequenciesData: *, my: *)

public

freqType(freq: *): *

public

getFrequencies(callback: *)

public

init()

public

loadFrequenciesData(url: *): *

public

loadLabels(bgFill: *, fontSizeFreq: *, fontSizeUnit: *, fontType: *, textColorFreq: *, textColorUnit: *, textAlign: *, container: *)

public

render()

public

resample(oldMatrix: *): *

public

unitType(freq: *): *

public
public

updateScroll(e: *)

Inherited Summary

From class Observer
public

fireEvent(event: string, args: ...any)

Manually fire an event

public

Attach a handler function for an event.

public

once(event: string, handler: function): ListenerDescriptor

Attach a handler to an event.

public

un(event: string, fn: function)

Remove an event handler.

public

unAll()

Remove all event handlers.

Static Public Methods

public static create(params: SpectrogramPluginParams): PluginDefinition source

Spectrogram plugin definition factory

This function must be used to create a plugin definition which can be used by wavesurfer to correctly instantiate the plugin.

Params:

NameTypeAttributeDescription
params SpectrogramPluginParams

Parameters used to initialise the plugin

Return:

PluginDefinition

An object representing the plugin.

Public Constructors

public constructor() source

Instantiate Observer

Override:

Observer#constructor

Public Members

public alpha: * source

public container: * source

public fftSamples: * source

public frequenciesDataUrl: * source

public height: * source

public noverlap: * source

public params: * source

public pixelRatio: * source

public spectrCc: * source

public util: * source

public wavesurfer: * source

public width: * source

public windowFunc: * source

public wrapper: * source

Public Methods

public createCanvas() source

public createWrapper() source

public destroy() source

public drawSpectrogram(frequenciesData: *, my: *) source

Params:

NameTypeAttributeDescription
frequenciesData *
my *

public freqType(freq: *): * source

Params:

NameTypeAttributeDescription
freq *

Return:

*

public getFrequencies(callback: *) source

Params:

NameTypeAttributeDescription
callback *

public init() source

public loadFrequenciesData(url: *): * source

Params:

NameTypeAttributeDescription
url *

Return:

*

public loadLabels(bgFill: *, fontSizeFreq: *, fontSizeUnit: *, fontType: *, textColorFreq: *, textColorUnit: *, textAlign: *, container: *) source

Params:

NameTypeAttributeDescription
bgFill *
fontSizeFreq *
fontSizeUnit *
fontType *
textColorFreq *
textColorUnit *
textAlign *
container *

public render() source

public resample(oldMatrix: *): * source

Params:

NameTypeAttributeDescription
oldMatrix *

Return:

*

public unitType(freq: *): * source

Params:

NameTypeAttributeDescription
freq *

Return:

*

public updateCanvasStyle() source

public updateScroll(e: *) source

Params:

NameTypeAttributeDescription
e *