Audio · class

TapTempo

Tempo and phase, from somebody tapping along.

Explained in Your first game.

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

In depth

Phase is the part that matters. A player could type a BPM; what they cannot type is where the downbeat falls in the sound they are about to add, and a grid at the right tempo with the wrong phase is off by up to half a beat everywhere — worse than not syncing at all.

Accessors

NameTypeDescription
bpmgetnumber | nullNull until there is enough to be sure, and for anything implausible.
offsetSecgetnumberSeconds, from the same clock the taps were given in.

Methods

tap

tap(nowMs: number): void
ParameterTypeDescription
nowMsnumber

reset

reset(): void