SpatialAudioParams
Spatial audio parameters.
public class SpatialAudioParams : OptionalJsonParse
{
public Optional<double> speaker_azimuth = new Optional<double>();
public Optional<double> speaker_elevation = new Optional<double>();
public Optional<double> speaker_distance = new Optional<double>();
public Optional<int> speaker_orientation = new Optional<int>();
public Optional<bool> enable_blur = new Optional<bool>();
public Optional<bool> enable_air_absorb = new Optional<bool>();
public Optional<double> speaker_attenuation = new Optional<double>();
public Optional<bool> enable_doppler = new Optional<bool>();
}
Properties
- speaker_azimuth
- The horizontal angle of the remote user or media player relative to the local user. Range: [0,360], in degrees:
- 0: (default) 0 degrees, directly in front.
- 90: 90 degrees, to the left.
- 180: 180 degrees, behind.
- 270: 270 degrees, to the right.
- 360: 360 degrees, directly in front.
- speaker_elevation
- The elevation angle of the remote user or media player relative to the local user. Range: [-90,90], in degrees:
- 0: (default) 0 degrees, no vertical rotation.
- -90: -90 degrees, rotated downward.
- 90: 90 degrees, rotated upward.
- speaker_distance
- The distance between the remote user or media player and the local user. 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. Range: [0,180], in degrees:
- 0: (default) 0 degrees, facing the same direction.
- 180: 180 degrees, facing each other.
- enable_blur
- Whether to enable sound blur processing:
- true: Enable blur.
- false: (default) Disable blur.
- enable_air_absorb
- Whether to enable air absorption, simulating timbre attenuation during sound propagation in air: high frequencies attenuate faster than low frequencies over distance.
- true: (default) Enable air absorption. Make sure
speaker_attenuationis not0, otherwise this setting has no effect. - false: Disable air absorption.
- true: (default) Enable air absorption. Make sure
- speaker_attenuation
- The sound attenuation coefficient of the remote user or media player. Range: [0,1]:
- 0: Broadcast mode, no volume or timbre attenuation with distance.
- (0,0.5): Weak attenuation, slight volume and timbre attenuation (requires
enable_air_absorb), allowing sound to travel farther than in real environments. - 0.5: (default) Simulates real-world volume attenuation, same as not setting
speaker_attenuation. - (0.5,1]: Strong attenuation, rapid volume and timbre attenuation (requires
enable_air_absorb).
- enable_doppler
-
Note:Whether to enable Doppler effect: when there is relative motion between the sound source and receiver, the pitch changes.
- This parameter applies to scenarios with fast-moving sound sources (e.g., racing games). It is not recommended for typical audio/video interaction scenarios (voice chat, co-hosting, online karaoke).
- When enabled, it is recommended to update the relative distance between the source and receiver at regular intervals (e.g., every 30 ms) using UpdatePlayerPositionInfo, UpdateSelfPosition, and UpdateRemotePosition. The Doppler effect may not work as expected or may cause audio jitter if: the update interval is too long, updates are irregular, or distance info is lost due to packet loss or latency.
- true: Enable Doppler effect.
- false: (default) Disable Doppler effect.