Spatial audio
Audity’s spatial nodes let a graph react to where the listener is relative to the sound: distance for falloff, angle for panning, closing speed for Doppler. Three nodes cover it: Listener Info, Pan, and Doppler.
How spatial data reaches the graph
Section titled “How spatial data reaches the graph”When an Audity Source plays a graph that uses Listener Info, the component pushes the listener and emitter world positions (and, when available, the listener’s orientation and both velocities) to the playing instance every frame. The values hold between pushes. You do not wire anything up for this; it happens because the graph contains a Listener Info node.
If you drive a graph without an Audity Source, you can push the same data
yourself with AudityMessaging.SetSpatial; see the
Scripting guide.
Listener Info
Section titled “Listener Info”Listener Info has no inputs. Its outputs describe the listener relative to this emitter:
- Distance (Float) - metres between listener and emitter.
- Direction (Vector 3) - unit vector from the emitter toward the listener.
- Listener Position, Emitter Position (Vector 3) - the raw world positions.
- Azimuth (Float) - horizontal angle, listener-relative (0 ahead, + to the right).
- Elevation (Float) - vertical angle.
- Relative Speed (Float) - closing speed along the line between them (+ when approaching).
Wire these into the rest of the graph like any Float value: Distance through a Remap or Curve into a Gain for falloff, Azimuth into a Pan for direction, Relative Speed into Doppler. Because these arrive from the game per frame, a teleport can make them jump; run a jumpy value through Slew first if that causes a click.
Pan places a mono source on a fixed speaker layout using constant-power pairwise gains, so the perceived loudness stays even as the source moves around the ring. The LFE channel stays silent.
- In: in (mono audio), Azimuth (degrees; 0 ahead, + right, +/-180 behind).
- Out: audio at the chosen layout width.
- Layout: Stereo, Quad, Surround 5.0, 5.1, 7.1.
Wire Listener Info > Azimuth into Pan > Azimuth to point the source at the listener. Pan is a positioning tool on the graph’s own bus; it does not replace Unity’s 3D AudioSource panning, it gives you a graph-authored alternative with a layout you choose.
Doppler
Section titled “Doppler”Doppler converts closing speed into a pitch shift.
- In: Speed (world units/s; + approaching), Scale (exaggeration, default 1; 0 disables).
- Out: Ratio (a pitch multiplier, 1 = unshifted) and Semitones (the same shift in semitones).
- Settings: Speed Of Sound (default 343).
Wire Listener Info > Relative Speed into Doppler > Speed, then the Semitones output into a Wave Player > Pitch. A Wave Player reads Pitch live per block, so the shift tracks the motion continuously. As with any game-fed value, Slew the speed first if objects can teleport.
A typical spatial chain
Section titled “A typical spatial chain”A moving vehicle might wire:
- Listener Info Distance into a Curve into a Gain (falloff).
- Listener Info Azimuth into Pan (direction).
- Listener Info Relative Speed into Doppler into the engine Wave Player’s Pitch (Doppler).
All three come from the one Listener Info node, fed automatically by the Audity Source.
Pattern: radio voice with a live dry version
Section titled “Pattern: radio voice with a live dry version”A character talks over the radio - filtered, non-spatial, always audible - and as you approach them you also hear their real voice, dry and placed in space. Both are the same performance, so they must stay sample-locked: one graph, one Wave Player, two chains into one Mixer.
- Radio chain: Wave Player → Filter (Bandpass around the voice band) → Shaper (light Tanh drive) → Gain → Mono To Stereo → Mixer.
- Dry chain: Wave Player → Gain, driven by Listener Info Distance through a Curve (full near, silent by a few metres) → Pan, aimed by Listener Info Azimuth → Mixer.
Keep the AudioSource’s Spatial Blend at 0 - the radio half must not be spatialized, and the dry half positions itself in-graph (see Audity and Unity audio). Optionally drive the radio chain’s Gain from the same Distance through an inverted Curve, so the radio recedes slightly as the real voice takes over.
Two details make this work: the Mixer needs matching widths on its inputs, which is what the Mono To Stereo on the radio chain is for - and because both chains pull one Wave Player, the versions can never drift, which is exactly what goes wrong when this is attempted with two separate AudioSources.