FreakingGenius - v0.1.0
    Preparing search index...

    Class EchoCancellation

    Applies acoustic echo cancellation to incoming microphone PCM frames.

    const aec = new EchoCancellation({ sampleRateHz: 16_000, filterLengthSamples: 512, stepSize: 0.01 });
    audioOutput.onPlay((ref) => aec.updateReference(ref));
    capture.onChunk((mic) => vad.feed(aec.process(mic)));
    Index

    Constructors

    Methods

    • Processes a microphone PCM chunk, subtracting the reference echo.

      Parameters

      • micChunk: Float32Array

        Raw microphone samples (Float32, range [-1, 1]).

      Returns Float32Array

      Echo-cancelled PCM samples with the same length as micChunk.

    • Resets the adaptive filter coefficients to their initial state. Call this after a long period of silence or when starting a new session.

      Returns void

    • Updates the reference signal buffer with audio that is about to be played. Must be called before playback reaches the speakers to allow the filter to align the reference with the captured echo.

      Parameters

      • playbackChunk: Float32Array

        PCM samples being sent to the speaker output.

      Returns void