• Public
  • Public/Protected
  • All

Interface default

Meyda is a library for extracting audio features from an audio signal.

The primary entry points are extract for audio feature extraction on raw signals you have in memory, and createMeydaAnalyzer, which provides a MeydaAnalyzer object that can be used to extract features on a Web Audio API AudioNode. The latter is only supported on web targets, though if you're using the Web Audio API in a non-web target, we'd love to hear from you.

We also expose listAvailableFeatureExtractors which returns a list of the available feature extractors, and windowing, which lets you apply a windowing function to your signal outside of Meyda.

We existed long before esmodules, so our backwards compatible API may seem unusual. We export a default object, with read/write fields that control various parameters of the audio feature extraction process. We're working on a new interface, check out #257 for more information.


  • default




audioContext: null | AudioContext

Meyda stores a reference to the relevant audio context here for use inside the Web Audio API.


bufferSize: number

The length of each buffer that Meyda will extract audio on. When recieving input via the Web Audio API, the Script Processor Node chunks incoming audio into arrays of this length. Longer buffers allow for more precision in the frequency domain, but increase the amount of time it takes for Meyda to output a set of audio features for the buffer. You can calculate how many sets of audio features Meyda will output per second by dividing the buffer size by the sample rate. If you're using Meyda for visualisation, make sure that you're collecting audio features at a rate that's faster than or equal to the video frame rate you expect.


chromaBands: number

The number of bands to divide the spectrum into for the Chroma feature extractor. 12 is the standard number of semitones per octave in the western music tradition, but Meyda can use an arbitrary number of bands, which can be useful for microtonal music.


featureExtractors: any


melBands: number

The number of Mel bands to use in the Mel Frequency Cepstral Co-efficients feature extractor


numberOfMFCCCoefficients: number

The number of MFCC co-efficients that the MFCC feature extractor should return


sampleRate: number

The number of samples per second of the incoming audio. This affects feature extraction outside of the context of the Web Audio API, and must be set accurately - otherwise calculations will be off.


windowingFunction: string

Specify the windowing function to apply to the buffer before the transformation from the time domain to the frequency domain is performed

The default windowing function is the hanning window.



  • summary

    Create a MeydaAnalyzer

    A factory function for creating a MeydaAnalyzer, the interface for using Meyda in the context of Web Audio.

    const analyzer = Meyda.createMeydaAnalyzer({
    "audioContext": audioContext,
    "source": source,
    "bufferSize": 512,
    "featureExtractors": ["rms"],
    "inputs": 2,
    "callback": features => {
    levelRangeElement.value = features.rms;


    • MeydaAnalyzerOptions: any

    Returns MeydaAnalyzer


  • Extract an audio feature from a buffer

    Unless meyda.windowingFunction is set otherwise, extract will internally apply a hanning window to the buffer prior to conversion into the frequency domain.

    meyda.bufferSize = 2048;
    const features = meyda.extract(['zcr', 'spectralCentroid'], signal);

    Aside: yes, you need to modify the value of a field of the default export of the package to change the buffer size. We realise this now seems not a good practice. See this issue to track our progress on implementing a more modern API.


    Returns null | Partial<MeydaFeaturesObject>



  • List available audio feature extractors. Return format provides the key to be used in selecting the extractor in the extract methods

    Returns MeydaAudioFeature[]


Generated using TypeDoc