Audio · class

KickDetector

Explained in Your first game.

class KickDetector
import { KickDetector } from '@driftengine/audio';

Constructor

new

constructor(nodes: KickDetectorNodes)
ParameterTypeDescription
nodesKickDetectorNodes

Properties

NameTypeDescription
pulsenumber0–1, spiking on a kick and decaying back. What a light should follow.
energynumberSmoothed low-end presence, for anything that wants level rather than hits.
levelnumber0–1, how much low end is arriving that the bassline does not explain.
More

The one to drive a visual from, and energy is usually not. energy is the raw sum of the two lowest bands with a gain on it, which is honest about what it says and useless on anything mastered loud: on a bass-heavy master it reaches its own ceiling and stays there, so a consumer reading it draws a constant. Measured on a bass-heavy track through this detector: energy sat at 1.000 in every frame of a two-minute sample.

This is the whitened signal the detector already computes for its own gating — the level left after the bassline, the mud and the low mids are masked out of it — which is the part that actually moves with the kick rather than with how loud the track is. It keeps its dynamics on the same material where energy has none, and it is deliberately not scaled: it usually runs well under 0.25, and how far a consumer opens that up is a decision about its own picture rather than about the music.

Methods

update

update(nowMs: number): void

One frame. Reads the analysers and advances the pulse.

ParameterTypeDescription
nowMsnumber