API reference
Preparing search index…

SoundRecorder

Capture device audio and process interleaved 16-bit PCM in a Node Worker.

Type hierarchy

Hierarchy (View Summary)

Source & inheritance
Member directory18

Constructors

Properties

Methods

Constructors

Properties

queue: AudioQueue = ...
Source & inheritance

Methods

  • Return the speaker position mapping of the capture channels.

    Returns

    Readonly
    Source & inheritance
  • Return the first Worker or subclass callback error, or undefined if none.

    Returns

    undefined | Error
    Source & inheritance
  • Receive a completed native recording buffer.

    Parameters

    buffer
    AudioHandle<"bufferData">

    Returns

    void
    Source & inheritance
  • Enable recording callbacks on the owning JS thread as needed; ordinary Worker recorders do not use this pipeline.

    Returns

    undefined | AudioRecorderCallbacks
    Source & inheritance
  • Set the capture channel count; wait for the current asynchronous recording operation to finish before calling.

    Parameters

    count
    number

    Returns

    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
  • Return the names of currently available recording devices.

    Returns

    string[]
    Source & inheritance

Symbol members

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

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