A-Tractor - v2.5.6
    Preparing search index...

    Class WaveformAnalyzer

    Waveform analyzer widget.

    Example:

    const audioElement = document.getElementById('audio');
    const viewElement = document.getElementById('div-analyzer');

    const w = new WaveformAnalyzer(audioElement, viewElement, { color: '#00ff00' });

    // We can start only after user starts interact with our page.
    // This is because of HTML Web Audio API restriction.
    document.body.onclick = () => {
    audioElement.play();
    w.start();
    }

    See more options at interface definition: common.IAbstractAnalyzerOptions

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Changes the current media source.

      Parameters

      • OptionalaudioSource: HTMLMediaElement | MediaElementAudioSourceNode

        Input HTML element with source audio (HTML audio tag) or the instance of MediaElementAudioSourceNode.

      Returns void

    • Returns a frequency for the given bin index.

      Parameters

      • index: number

        Bin index.

      Returns number

    • Returns the frequency resolution of the audio (frequency step of one bin).

      frequencyResolution = fullFrequencyRange / frequencyBinCount; For example one bin can be: 24000 / 128 = 187.5 Гц

      Returns number

    • Returns the full frequency range of the audio.

      For example it can be: 24000 Гц for sample rate 48000 Hz.

      Returns number

    • Returns the sample rate of the audio (sampling frequency).

      For example it can be: 48000 Hz.

      Returns number

    • Updates the canvas size depended on the [[constructor|viewElement]] size.

      Returns void