Function createAudioAnalyser

  • Creates and returns an analyser web audio node that is attached to the provided track. Additionally returns a convenience method calculateVolume to perform instant volume readings on that track. Call the returned cleanup function to close the audioContext that has been created for the instance of this helper

    Parameters

    Returns {
        analyser: AnalyserNode;
        calculateVolume: (() => number);
        cleanup: (() => Promise<void>);
    }

    • analyser: AnalyserNode
    • calculateVolume: (() => number)
        • (): number
        • Calculates the current volume of the track in the range from 0 to 1

          Returns number

    • cleanup: (() => Promise<void>)
        • (): Promise<void>
        • Returns Promise<void>