Whistle API
    Preparing search index...

    Interface UseWhistleReturn

    State and actions returned by useWhistle. Actions reject typed errors; observe their promises.

    interface UseWhistleReturn {
        error: WhistleError | undefined;
        pending: number;
        progress: LoadProgress | undefined;
        ready: boolean;
        result: WhistleTranscript | undefined;
        status: WhistleStatus;
        cancel(): void;
        load(): Promise<void>;
        transcribe(
            audio: Float32Array,
            options?: TranscribeOptions,
        ): Promise<WhistleTranscript>;
        transcribeFile(
            file: Blob,
            options?: TranscribeOptions,
        ): Promise<WhistleTranscript>;
    }

    Hierarchy (View Summary)

    Index
    • Cancel loading and all active/queued requests with ABORTED. Keeps a loaded instance reusable. Does not stop a separate recorder's capture; use that recorder's cancel as well.

      Returns void

    • Explicitly load the configured engine. Concurrent calls share initialization.

      Returns Promise<void>

      Readiness; resolves immediately if already loaded.

      WhistleError for asset/runtime failure, ABORTED after cancel, or DISPOSED after unmount.

    • Queue one completed clip after loading.

      Parameters

      • audio: Float32Array

        1–480,000 finite mono 16 kHz samples in [-1, 1], copied at invocation.

      • Optionaloptions: TranscribeOptions

        Per-request hints, timestamps and cancellation; also snapshotted at invocation.

      Returns Promise<WhistleTranscript>

      The transcript once earlier surviving requests finish.

      WhistleError for invalid input, MODEL_LOAD_FAILED before readiness, ABORTED, DISPOSED or engine failures. Caller buffers stay attached and owned by the caller.

    • Queue browser decoding and transcription in the same FIFO as PCM calls.

      Parameters

      • file: Blob

        Encoded File/Blob; decoder support depends on the browser.

      • Optionaloptions: TranscribeOptions

        Per-request hints, timestamps and a signal covering both decode and inference.

      Returns Promise<WhistleTranscript>

      The completed transcript; files exceeding 30 seconds reject without truncation.

      WhistleError for decode, readiness, inference, cancellation or disposal failures.

    error: WhistleError | undefined

    Latest failure, including ABORTED; cleared when starting new work or on success.

    pending: number

    Number of active and queued transcription requests; excludes model loading and recording.

    progress: LoadProgress | undefined

    Most recent truthful per-asset initialization progress, or undefined before loading.

    ready: boolean

    Whether load has completed. Active inference cancellation may require worker recovery.

    result: WhistleTranscript | undefined

    Last successful transcript; retained across cancellation and pagehide/effect replay.

    Current loading or active request stage; idle also includes an unloaded engine.