Audio · function

convolverInsert

A convolver, built once at registration.

Explained in Your first game.

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

Parameters

ParameterTypeDescription
contextBaseAudioContext
secondsnumber
decaynumber
random() => number

In depth

Never on entry to anything. Building an impulse allocates a stereo buffer and fills it sample by sample, which costs milliseconds; doing that when a player crosses a threshold would put both the allocation and the cost on the input path at the exact moment something is supposed to happen.