An HRTFInput node represents a spatial audio source being heard by the listener. The audio source can be a remote source provided via a WebRTC transport, or a local source such as an environment sound.

Example

// Remote source
const mediaStreamTrack = audioTrack.getMediaStreamTrack();
const mediaStream = new MediaStream([mediaStreamTrack]);
const sourceNode = audioContext.createMediaStreamSource(mediaStream);
const hrtfInput = new HRTFInput(audioContext);
sourceNode.connect(hrtfInput);
// Local source
const sourceNode = new AudioBufferSourceNode(audioContext);
sourceNode.buffer = audioBuffer;
sourceNode.loop = true;
const hrtfInput = new HRTFInput(audioContext);
sourceNode.connect(hrtfInput);

Hierarchy

  • AudioWorkletNode
    • HRTFInput

Constructors

Methods

Constructors

  • Parameters

    Returns HRTFInput

Methods

  • 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 position and orientation of this audio source relative to the listener.

    Parameters

    • azimuth: number

      The angle from the direction the listener is facing to the position of the source, in radians.

    • distance: number

      The source's distance from the listener, in meters.

      WebAudio Nodes

    Returns void

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