Audio · function

cutoffForSpeed

Master low-pass cutoff in Hz for a given speed.

Explained in Your first game.

function cutoffForSpeed(speed: number, maxSpeed: number): number
import { cutoffForSpeed } from '@driftengine/audio';

Parameters

ParameterTypeDescription
speednumber
maxSpeednumber

In depth

Exponential in frequency because hearing is: a linear sweep spends most of its travel in a range that sounds like almost nothing is happening. This is the "filter opens as you hit full sprint" moment, so it has to track the feeling of accelerating rather than the number.