API reference
Preparing search index…

SoundBufferRecorder

Recorder that saves captured PCM in a SoundBuffer.

Type hierarchy

Hierarchy (View Summary)

Source & inheritance
Member directory22

Constructors

Properties

Methods

Constructors

Properties

queue: AudioQueue = ...
Source & inheritance

Methods

  • Return the most recently completed recording buffer; retrieve new results after await stop().

    Returns

    Readonly
    Source & inheritance
  • Receive an independent native buffer; later recordings do not modify a previously returned SoundBuffer.

    Parameters

    buffer
    AudioHandle<"bufferData">

    Returns

    void
    Source & inheritance
  • Serially process interleaved 16-bit PCM on the object's owning JS thread; lengths count samples, not frames. Native views are valid only until this synchronous or asynchronous callback ends; false stops capture asynchronously. By default, appends incoming samples to the native accumulator. You may modify samples before calling super; without super, samples are not saved.

    Parameters

    samples
    Int16Array

    Returns

    boolean | Promise<boolean>
    Source & inheritance
  • Called on the object's owning JS thread before capture begins; supports synchronous or asynchronous returns, with false rejecting capture. By default, clears this session's native PCM accumulator and recording buffer without accessing the microphone.

    Returns

    boolean | Promise<boolean>
    Source & inheritance
  • Called once on the object's owning JS thread after the device stops and delivered callbacks finish; supports asynchronous completion. Rejection, cancellation, and errors also trigger it. By default, finalizes PCM appended through super into a SoundBuffer.

    Returns

    void | Promise<void>
    Source & inheritance
  • Asynchronously switch recording devices and return whether it succeeded. Runs in invocation order; must not be called from subclass callbacks.

    Parameters

    name
    string

    Returns

    Promise<boolean>
    Source & inheritance
  • Asynchronously initialize capture, defaulting to 44100 Hz; return false if already capturing, rejected, or startup fails. Do not restart from subclass callbacks; await stop() externally before starting the next session.

    Parameters

    sampleRate
    number = 44100

    Returns

    Promise<boolean>
    Source & inheritance
  • Asynchronously stop capture and await remaining samples and onStop. Inside subclass callbacks, await stop() only waits for the device to stop, avoiding a self-wait. Draining continues after the callback exits; await stop() again externally to wait for full completion.

    Returns

    Promise<void>
    Source & inheritance

Symbol members

"[audioHandle]": AudioHandle<"recorder">
Source & inheritance

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