Audio · function

stereoPan

Where a source sits across the stereo field, from a listener facing yaw.

Explained in Your first game.

function stereoPan(dx: number, dz: number, yaw: number): number
import { stereoPan } from '@driftengine/audio';

Parameters

ParameterTypeDescription
dxnumber
dznumber
yawnumber

In depth

-1 hard left, 0 centre or directly ahead/behind, 1 hard right. Yaw 0 faces −Z, matching the convention the rest of the engine's cameras and controls use, so the listener's right is (cos yaw, 0, sin yaw).

Horizontal only. Height is deliberately ignored: stereo cannot express it, and folding it in would quietly pull a source overhead toward the centre for no reason a listener could interpret.