A NoiseGate node is used to condition the output from a microphone. It helps remove background noise and reduce network bandwidth and CPU load by suppressing audio at levels below an adjustable threshold.

A NoiseGate can also be used to mute audio while maintaining the audio stream so that, for example, position Metadata continues to be sent.

Example

const noiseGate = new NoiseGate(audioContext);
if (muted) {
noiseGate.setThreshold(0);
} else {
noiseGate.setThreshold(-40);
}
const sourceNode = audioContext.createMediaStreamSource(mediaStream);
sourceNode.connect(noiseGate).connect(destinationNode);

Hierarchy

Constructors

  • Parameters

    Returns NoiseGate

Methods

  • Terminates processing so that the node can be garbage-collected.

    Returns void

  • Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

    Parameters

    • event: Event

    Returns boolean

  • Sets the noise threshold. Audio below the threshold is suppressed.

    Parameters

    • value: number

      A negative value between -96 and 0 which indicates a minimum decibel level for the noise gate to stop suppressing audio. A value of -96 turns off the noise gate so that it does not suppress any audio.

    Returns void

© 2023 High Fidelity, Inc. | All rights reserved Terms of Service | Privacy Policy