OptionalbandsLength of spectrum in a band frame; bin frames do not carry it.
OptionalchannelChannel count of the visualisation stream, sent with bin frames; 0
when unknown. With channels: 'stereo' and a count of 1, right
repeats left.
Channel layout of a bin frame.
OptionalfftFFT size actually used: for band frames after the automatic raise for large band counts, for bin frames the requested size.
Bin index of the first value in a bin frame; 0 when the range holds no bin.
OptionalhostHost system time when the frame was computed, Unix epoch milliseconds
with a fractional part. Compare with Date.now(); the page's
performance.timeOrigin + performance.now() drifts away from system
time the longer the page stays open.
OptionalmaxUpper edge of the highest band in Hz: the subscription's maxFrequency
capped at sampleRate / 2, or sampleRate / 2 when none was given;
0 when the sample rate is unknown.
OptionalminLower edge of the lowest band in Hz: the subscription's minFrequency, 20 by default.
What the frame carries. Older hosts send band frames without this field.
OptionalsampleSample rate of the visualisation stream in Hz; 0 when unknown.
OptionalscaleBin frames always report 'db'.
Power of all channels in dB, one value per bin from bin firstBin on.
Optionalstate'paused' / 'stopped' frames are single silence frames sent when
playback leaves the playing state; no frames follow until playback
resumes.
OptionalstreamSeconds since the visualisation stream last started; the frame is
computed from the fftSize samples ending at this time. Starting
playback, seeking and manual track changes restart it at 0, where it
stays for about 200 ms (silence frames); until fftSize / sampleRate
seconds have passed, the part of the window before the restart is
silence. Natural track transitions do not restart it. A frame is new
when this value changed.
OptionalsubscriptionSubscription the frame belongs to; absent in getSpectrum answers without one.
Frame of a subscription with
output: 'bins'andchannels: 'mix', delivered on the subscription's event and answered byaudio.getSpectrumfor it. A silence frame keeps the previous frame's length, filled with-160, and is empty when no frame came before it.