API reference
Preparing search index…

SoundBuffer

Views retain the exact native allocation from which they were obtained.

Source & inheritance
Member directory13

Constructors

Methods

Constructors

Methods

  • Return a read-only view of channel positions in interleaved order.

    Returns

    Readonly
    Source & inheritance
  • Return the total sample count across all channels.

    Returns

    bigint
    Source & inheritance
  • Return a read-only typed PCM view, or undefined for an empty buffer. After reloading, existing views still reference the old storage.

    Returns


        | undefined
        | Readonly<
            Pick<
                Int16Array,
                | number
                | typeof iterator
                | "length"
                | "slice"
                | "entries"
                | "keys"
                | "values"
                | "byteLength"
                | "byteOffset",
            >,
        >
    Source & inheritance
  • Asynchronously decode an entire audio file into native PCM storage, returning whether it succeeded.

    Parameters

    filename
    string

    Returns

    Promise<boolean>
    Source & inheritance
  • Asynchronously decode encoded audio bytes and replace the PCM, returning whether it succeeded.

    Parameters

    data
    Uint8Array

    Returns

    Promise<boolean>
    Source & inheritance
  • Synchronously copy interleaved 16-bit PCM and replace the contents; sampleRate is in Hz. Return whether it succeeded.

    Parameters

    data
    Int16Array
    channelCount
    number
    sampleRate
    number
    channelMap
    Iterable<SoundChannel>

    Returns

    boolean
    Source & inheritance
  • Asynchronously decode all samples from an input stream, returning whether it succeeded; stream errors reject the Promise.

    Parameters

    Returns

    Promise<boolean>
    Source & inheritance
  • Asynchronously encode and save using the file extension to select the format, returning whether it succeeded.

    Parameters

    filename
    string

    Returns

    Promise<boolean>
    Source & inheritance

Icons made by Lorc, Delapouite & Skoll · game-icons.net · CC BY 3.0