Audio · function

impulseResponse

A synthesised impulse response: exponentially decaying noise.

Explained in Your first game.

function impulseResponse(context: BaseAudioContext, seconds: number, decay: number, random: () => number): AudioBuffer
import { impulseResponse } from '@driftengine/audio';

Parameters

ParameterTypeDescription
contextBaseAudioContext
secondsnumber
decaynumber
random() => number

In depth

Not a real hall — a real one is a file, and files are what the registry is for. This exists so reverb works before any asset has been recorded, on the same principle as every other sound here.

random is a parameter rather than Math.random, and that is what makes a reverb tail assertable at all: an unseeded generator builds a different hall every construction, so no render carrying wet signal can be compared to another. Defaulting it here would have hidden that.