Skip to content

API Reference


API Reference / Kick

Type Alias: Kick ​

ts
type Kick = {
  contextTime: number;
  strength: number;
};

Defined in: contract/types.ts:358

Payload of kick: one kick drum the analyzer heard, as soon as it heard it, whichever engine runs.

Remarks ​

A kick is a sudden rise of energy under 150 Hz: the drum's attack. It is heard, not predicted, so it always comes after the sound reached the analyzer: at the listener, about 20 ms after in Chromium and 22 to 26 ms in Firefox, in the median on CI. A kick reported before a reset() is dropped, as a reading is.

Properties ​

PropertyModifierTypeDescriptionDefined in
contextTimereadonlynumberWhen the kick's attack reached the analyzer, in seconds on the AudioContext.currentTime clock, like AudioSpan.contextTime. For audio the context plays (a media element, a stream, a buffer), the listener hears it at contextTime + baseLatency + outputLatency. From a mic, the room heard it at about contextTime: it has already passed by the time the event fires.contract/types.ts:365
strengthreadonlynumberFrom 0 to 1: the kick's peak in the bass over the loudest kick's of the last 3.5 s, itself included, as an amplitude ratio. 1 is as loud as the loudest recent kick, 0.5 is 6 dB softer. Relative, so the range is the same from a quiet mic and a loud file. A kick more than 6 dB under that loudest one is not reported, so in practice it reads from 0.5 to 1. The meaning holds if that gate ever moves, so map the whole 0 to 1.contract/types.ts:372