Spatial audio
On , sound from reaches a listener at from two opposite directions along the same great circle: the short arc (+d, distance ) and the wrap-around complement (−d, distance ).
- Direct (+d)
- 14.66 m
- Complementary (−d)
- 73.30 m
- Echo delay (300 m/s)
- 195 ms
Path geometry
Section titled “Path geometry”| Case | Direct (+d) |
Complementary (−d) |
|---|---|---|
| Distinct () | ||
| Coincident () | ||
| Antipode () |
When and are coincident or antipodal (), S3AcousticPath.Resolve uses normalized localFallback ?? D4.Up as the local arrival axis.
Play a direct voice and a delayed echo
Section titled “Play a direct voice and a delayed echo”Attach this script to a Node and assign Clip in the Inspector. It starts the direct arrival immediately and delays the opposite-side echo by the travel-time difference at 300 m/s:
#nullable enableusing System;using Glome;using Glome.Core;using Godot;
public partial class EchoExample : Node{ [Export] public AudioStream? Clip { get; set; }
public override void _Ready() { if (Clip is not { } clip) return; var rig = new S3AudioRig { UseAudioCamera = GetViewport().GetCamera3D() is null }; AddChild(rig);
const double radius = 14; var listener = S3Frame.Identity; var source = new ArcRay(listener.P, listener.Right).At(Math.PI / 3); var path = S3AcousticPath.Resolve(listener, source, radius); double delay = (path.ComplementaryDistance - path.DirectDistance) / 300.0;
var model = AudioStreamPlayer3D.AttenuationModelEnum.InverseDistance; var near = rig.CreateVoice("Direct", "Master", -3, 120, 10, model); var far = rig.CreateVoice("Echo", "Master", -9, 120, 10, model); rig.Play(clip, listener, source, radius, new AudioPathVoice(near, -3), new AudioPathVoice(far, -9, DelaySeconds: delay)); }}Set UseAudioCamera = true before _Ready() if the viewport has no active 3D camera. Without DistanceOverride, voices are placed at least 0.15 m from the listener to avoid zero-distance attenuation spikes. S3AudioRig API