Audio · function
cutoffForSpeed
Master low-pass cutoff in Hz for a given speed.
Explained in Your first game.
function cutoffForSpeed(speed: number, maxSpeed: number): numberimport { cutoffForSpeed } from '@driftengine/audio';Parameters
| Parameter | Type | Description |
|---|---|---|
speed | number | |
maxSpeed | number |
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.