API Reference / AnalyzerEventMap
Type Alias: AnalyzerEventMap
type AnalyzerEventMap = {
statechange: StateChange;
reading: Reading;
progress: Progress;
error: AnalyzerError;
debug: DebugInfo;
kick: Kick;
};Defined in: contract/types.ts:403
The analyzer's events. May grow in a minor release: a new event type is additive, as nobody listens to it yet.
Remarks
Dispatch order, for each analysis step: state is updated, then statechange fires if the status, the listening reason or the epoch changed, then reading (settling, locked) or progress (listening). Never both a reading and a progress for one step. A reset() or stop() called from a listener is queued: it runs once every listener has had every event of the current step, so all listeners see the same sequence.
statechange: on every transition, and only then.reading: on each analysis step outsidelisteningthat measured something new. A measurement, not a state. The rate is the engine's:peaksmeasures every 4096-sample buffer, about 11 times a second at 44.1 or 48 kHz, andtempogramon each tempogram update, about twice a second.progress: on each analysis step whilelistening, and once right afterreset(), with 0.error: non-fatal faults. A fatal one is astatechangetostoppedwith reasonfailedinstead.debug: engine detail, only withdebug: true.kick: on each kick drum heard, inlistening,settlingandlockedalike, as soon as it is heard. Apart from the steps: it moves no state, and comes between their events, never inside one step's sequence.
Reserved for a later 6.x: a beat event, on the AudioContext clock (AudioSpan.contextTime). It belongs to the epoch and the stretch of audio it was predicted in: reset() and every move to listening cancel every predicted beat not yet dispatched, so no beat of an older epoch or a lost pulse is ever reported.
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
statechange | readonly | StateChange | contract/types.ts:404 |
reading | readonly | Reading | contract/types.ts:405 |
progress | readonly | Progress | contract/types.ts:406 |
error | readonly | AnalyzerError | contract/types.ts:407 |
debug | readonly | DebugInfo | contract/types.ts:408 |
kick | readonly | Kick | contract/types.ts:409 |