Inline: Out of Time - Positional Sound
Goal
Simulate basic distance and position driven acoustic properties including stereo panning, inverse-square law, and Doppler effect.
Notes
- For this model to more accurately respond to relative velocities and not be affected by framerate, the comparison of distance to last distance in the Doppler formula should be replaced with a velocity comparison scaled by \(\Delta \mathit{time}\).
- The volume scale formula modifies the powers of the inverse-square law to better fit gameplay, tuned to accentuate the volume ramp when the distance between the source and listener is either very small or greater than one screen width. When the distance is between these ranges, the change in volume with distance is less dramatic.
Algorithm
Driving Data:
- Relative positions of source and listener objects
Logic:
Each frame:
-
Set the stereo pan as a proportion of horizontal distance to camera bounds width.
\[\mathit{pan} = \frac{\mathit{source\ x} - \mathit{listener\ x}}{\mathit{width}}\]where \(\mathit{pan}\) controls left/right stereo balance, with -1 being fully left and 1 being fully right, \(\mathit{source\ x}\) is the source’s x position, \(\mathit{listener\ x}\) is the listener’s x position, and \(\mathit{width}\) is the width of the camera bounds.
- If the horizontal distance between the source and listener is less than two screen widths (scaled by a given parameter):
-
Scale volume with the following function:
\[\mathit{volume} \mathrel{*}= \frac{(\mathit{width} - \mathit{distance})^3}{(2 * \mathit{width})^3} + 0.5\]where \(\mathit{volume}\) scales the output volume from 0-1, \(\mathit{distance}\) refers to the 2-dimensional distance between the source and listener, and \(\mathit{width}\) is the width of the camera bounds.
-
Offset frequency with the following function:
\[\mathit{frequency} \mathrel{-}= \frac{\Delta \mathit{distance}}{(2 * \mathit{width})}\]where \(\mathit{frequency}\) offsets the sound’s frequency multiplier, \(\Delta \mathit{distance}\) refers to the change in 2-dimensional distance between the source and listener this frame, and \(\mathit{width}\) is the width of the camera bounds.
-
- If the horizontal distance between the source and listener is greater than two screen widths (scaled by a given parameter), set the source volume to 0.
Figures
Pan
Linear relationship between pan and horizontal distance between the source and listener.
Volume Scale
Relationship between volume scale and distance between the source and listener.
Frequency Offset
Linear relationship between frequency scale offset and distance between the source and listener.
Note that because the calculation result is subtracted from the frequency multiplier, the audible result is the inverse of the illustration above.
Related Posts

Inline: Out of Time - Audio Engine Overview
An overview of the powerful audio engine behind Inline: Out of Time's rich soundscape and audio-driven visuals.

Inline: Out of Time - Adaptive Soundtrack System Overview
Architecture breakdown of Inline: Out of Time's gameplay-driven adaptive soundtrack system.

Inline: Out of Time - Object Density Acoustic Model
Deconstruction and analysis of Inline: Out of Time's highly optimized environmentally-driven acoustic model.

Kouncil: Algorithm Reference
Every analysis algorithm in Kouncil, the mastering analyzer: loudness, dynamics, spectral, perceptual, stereo, codec simulation and render QC.