Skip to main content

Interface: VisualizerCapture

Defined in: packages/player/src/specs/mpv-client.nitro.ts:103

One analysed window of the audio mpv last handed to the audio device.

Remarks

The PCM itself never crosses into JavaScript. mpv's pcm-tap-frame property (added by the rn-media libmpv patch — see ARCHITECTURE §11 and §21) is read on a native sampler thread, downmixed, windowed and transformed there, and only the spectrum makes the trip. That is a performance decision, not a layering one: a 2048-point FFT is ~135 k float operations, which is nothing in C++ and is real work in Hermes, and it keeps the per-frame payload at ~4 KB of magnitudes instead of ~16 KB of samples.

Everything above the transform — dB mapping, log-spaced bands, smoothing, peak ballistics — stays in TypeScript, per subscriber, where it is unit-tested without a device (ARCHITECTURE §5).

Properties

capturedAt

readonly capturedAt: number;

Defined in: packages/player/src/specs/mpv-client.nitro.ts:121

Date.now()-comparable timestamp taken natively when the window was analysed.


dropped

readonly dropped: number;

Defined in: packages/player/src/specs/mpv-client.nitro.ts:133

Ticks skipped since the previous capture because JavaScript had not finished with the last one. Steadily non-zero means the listener cannot keep up with the requested frame rate.


fftSize

readonly fftSize: number;

Defined in: packages/player/src/specs/mpv-client.nitro.ts:117

Transform length in samples.


magnitudes

readonly magnitudes: ArrayBuffer;

Defined in: packages/player/src/specs/mpv-client.nitro.ts:110

fftSize / 2 + 1 little-endian Float32 linear magnitudes, normalised so that a full-scale sinusoid reads 1.0. Read it as a Float32Array.

Bin k is centred on k * sampleRate / fftSize Hz.


sampleRate

readonly sampleRate: number;

Defined in: packages/player/src/specs/mpv-client.nitro.ts:119

Sample rate of the tapped audio, in Hz.


seq

readonly seq: number;

Defined in: packages/player/src/specs/mpv-client.nitro.ts:127

mpv's tap sequence number — one increment per chunk the audio device consumed. Two captures with the same seq carry the same spectrum by construction, because they analysed the same samples.


waveform?

readonly optional waveform?: ArrayBuffer;

Defined in: packages/player/src/specs/mpv-client.nitro.ts:115

fftSize little-endian Float32 mono samples in [-1, 1], unwindowed, or undefined when the subscriber did not ask for time-domain data.