SpatialAudioParams

Spatial audio parameters.

export class SpatialAudioParams {
  
  speaker_azimuth?: number;
  
  speaker_elevation?: number;
  
  speaker_distance?: number;
  
  speaker_orientation?: number;
  
  enable_blur?: boolean;
  
  enable_air_absorb?: boolean;
  
  speaker_attenuation?: number;

  enable_doppler?: boolean;
}

Properties

speaker_azimuth
The horizontal angle of the remote user or media player relative to the local user. Value range: [0,360], in degrees:
  • 0: (default) 0 degrees, directly in front on the horizontal plane.
  • 90: 90 degrees, to the left on the horizontal plane.
  • 180: 180 degrees, directly behind on the horizontal plane.
  • 270: 270 degrees, to the right on the horizontal plane.
  • 360: 360 degrees, same as 0 degrees.
speaker_elevation
The vertical angle (elevation) of the remote user or media player relative to the local user. Value range: [-90,90], in degrees:
  • 0: (default) 0 degrees, no tilt on the horizontal plane.
  • -90: -90 degrees, tilted downward 90 degrees.
  • 90: 90 degrees, tilted upward 90 degrees.
speaker_distance
The distance of the remote user or media player from the local user. Value range: [1,50], in meters. Default is 1 meter.
speaker_orientation
The orientation of the remote user or media player relative to the local user. Value range: [0,180], in degrees:
  • 0: (default) 0 degrees, source and listener face the same direction.
  • 180: 180 degrees, source and listener face each other.
enable_blur
Whether to enable sound blurring:
  • true: Enable blurring.
  • false: (default) Disable blurring.
enable_air_absorb
Whether to enable air absorption, simulating the attenuation of sound timbre during air transmission: high frequencies attenuate faster than low frequencies over distance.
  • true: (default) Enable air absorption. Ensure speaker_attenuation is not 0, otherwise this setting has no effect.
  • false: Disable air absorption.
speaker_attenuation
Attenuation coefficient of the remote user or media player sound. Value range: [0,1]:
  • 0: Broadcast mode. Volume and timbre do not attenuate with distance.
  • (0,0.5): Weak attenuation. Volume and timbre (requires enable_air_absorb) attenuate slightly, allowing sound to travel farther than in real environments.
  • 0.5: (default) Simulates real-world volume attenuation. Equivalent to not setting speaker_attenuation.
  • (0.5,1]: Strong attenuation. Volume and timbre (requires enable_air_absorb) attenuate rapidly.
enable_doppler
Note:
  • This parameter is suitable for scenarios with fast-moving sound sources (e.g., racing games). It is not recommended in typical audio/video interaction scenarios (voice chat, co-hosting, online karaoke).
  • When enabled, it is recommended to update the relative distance between source and listener periodically (e.g., every 30 ms) by calling updatePlayerPositionInfo, updateSelfPosition, and updateRemotePosition. The Doppler effect may not work as expected or may produce jitter if: update interval is too long, update interval is irregular, or distance info is lost due to network packet loss or latency.
Whether to enable Doppler effect: when the sound source and listener move relative to each other, the pitch heard by the listener changes.
  • true: Enable Doppler effect.
  • false: (default) Disable Doppler effect.