foo-webview-sdk
    Preparing search index...

    Interface SpectrumMixBinsFrame

    Frame of a subscription with output: 'bins' and channels: 'mix', delivered on the subscription's event and answered by audio.getSpectrum for it. A silence frame keeps the previous frame's length, filled with -160, and is empty when no frame came before it.

    interface SpectrumMixBinsFrame {
        bands?: number;
        channelCount?: number;
        channels: "mix";
        fftSize?: number;
        firstBin: number;
        hostTime?: number;
        maxFrequency?: number;
        minFrequency?: number;
        output: "bins";
        sampleRate?: number;
        scale?: SpectrumScale;
        spectrum: number[];
        state?: SpectrumFrameState;
        streamTime?: number;
        subscriptionId?: string;
    }

    Hierarchy (View Summary)

    Index
    bands?: number

    Length of spectrum in a band frame; bin frames do not carry it.

    channelCount?: number

    Channel count of the visualisation stream, sent with bin frames; 0 when unknown. With channels: 'stereo' and a count of 1, right repeats left.

    channels: "mix"

    Channel layout of a bin frame.

    fftSize?: number

    FFT size actually used: for band frames after the automatic raise for large band counts, for bin frames the requested size.

    firstBin: number

    Bin index of the first value in a bin frame; 0 when the range holds no bin.

    hostTime?: number

    Host 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.

    maxFrequency?: number

    Upper 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.

    minFrequency?: number

    Lower edge of the lowest band in Hz: the subscription's minFrequency, 20 by default.

    output: "bins"

    What the frame carries. Older hosts send band frames without this field.

    sampleRate?: number

    Sample rate of the visualisation stream in Hz; 0 when unknown.

    Bin frames always report 'db'.

    spectrum: number[]

    Power of all channels in dB, one value per bin from bin firstBin on.

    'paused' / 'stopped' frames are single silence frames sent when playback leaves the playing state; no frames follow until playback resumes.

    streamTime?: number

    Seconds 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.

    subscriptionId?: string

    Subscription the frame belongs to; absent in getSpectrum answers without one.