ixfx
    Preparing search index...

    Class AudioAnalyser

    Helper for doing audio analysis. It takes case of connecting the audio stream, running in a loop and pause capability.

    Provide a function which works with an AnalyserNode, and does something with the result.

    const myAnalysis = (node, analyser) => {
    const freq = new Float32Array(node.frequencyBinCount);
    node.getFloatFrequencyData(freq);
    // Do something with frequency data...
    }
    const a = new Analyser(myAnalysis);

    Helper functions provide ready-to-use Analysers:

    Note: Browers won't allow microphone access unless the call has come from a user-interaction, eg pointerup event handler.

    Constructors

    Properties

    analyse: DataAnalyser
    analyserNode: undefined | AnalyserNode
    audioCtx: undefined | AudioContext
    debug: boolean
    fftSize: number
    showVis: boolean
    smoothingTimeConstant: number
    visualiser: undefined | AudioVisualiser

    Accessors

    • get paused(): boolean

      Returns boolean

    • set paused(v: boolean): void

      Parameters

      • v: boolean

      Returns void

    Methods

    • Returns the starting frequency for a given binned frequency index.

      Parameters

      • index: number

        Array index

      Returns number

      Sound frequency

    • Returns the maximum FFT value within the given frequency range

      Parameters

      • lowFreq: number
      • highFreq: number
      • freqData: readonly number[]

      Returns number

    • Returns a binned array index for a given frequency

      Parameters

      • freq: number

        Sound frequency

      Returns number

      Array index into frequency bins

    • Returns void

    • Returns a sub-sampling of frequency analysis data that falls between lowFreq and highFreq.

      Parameters

      • lowFreq: number

        Low frequency

      • highFreq: number

        High frequency

      • freqData: readonly number[]

        Full-spectrum frequency data

      Returns number[]

      Sub-sampling of analysis