Labs / QUBICENGINE HANDBOOK

Positional audio relationships

Move a source around a listener and inspect illustrative attenuation and stereo coefficients.

Inspect the relationship#

Move a source around a listener and inspect illustrative attenuation and stereo coefficients.

INTERACTIVE ILLUSTRATIONSIMULATION / BROWSER

Move a source around a listener This illustration uses canvas. The explanation below describes the same process.

Change a control to inspect the result. Values describe the simulation, not native engine benchmarks. Open full lab ↗

Try these experiments#

Move the source close to the listener, then farther away. Compare the gain. Move it to the listener’s left and right and inspect the two channel bars. The lab draws the relationship without generating sound.

What the illustration calculates#

Distance is the Euclidean separation. An illustrative attenuation curve uses 1/(1+distance²). Pan is derived from horizontal direction, and equal-power left/right coefficients distribute that gain. These are inspectable teaching choices, not a complete headphone HRTF or production spatializer. A native audio system accounts for listener orientation, channel layout, voice type, device format, and sample-rate processing. A source behind the listener needs more than a simple left/right scalar to create convincing spatial perception.

Connect it to AudioWorld#

Scene provides source and listener transforms after simulation. AudioWorld submits compact parameter updates to a mixer running independently of display frames. Voices retain sample or streaming storage until audio-thread acknowledgment allows release. GPU fences do not prove the mixer has stopped reading an audio buffer.

The teaching curve
text · REFERENCE EXCERPT
distance = length(source - listener)
gain = 1 / (1 + distance * distance)
left = gain * sqrt((1 - pan) / 2)
right = gain * sqrt((1 + pan) / 2)

The reference engine chooses attenuation and spatialization according to voice content and the actual output environment. Parameter smoothing prevents abrupt gain changes from producing clicks.

What to inspect when it is wrong#

Silence may be a voice state, gain, device, or asset issue before it is a position issue. An attenuation curve with mismatched units can make every source inaudible. Audio underruns can come from blocking decode work in the callback. The website deliberately provides no sound-output toggle that would pretend to run that native system. Read audio and asset ownership.

Search titles and full article text.