Whistle API
    Preparing search index...

    Function decodeAudio

    • Decode a completed audio File/Blob into 16 kHz mono PCM for transcription.

      Parameters

      • input: Blob

        Nonempty encoded audio; supported codecs depend on the browser.

      • options: { signal?: AbortSignal } = {}

        Optional cancellation for decoding and rendering.

      Returns Promise<Float32Array<ArrayBufferLike>>

      Newly owned finite PCM samples in [-1, 1], at most 480,000 samples.

      WhistleError with AUDIO_DECODE_FAILED for invalid/unsupported input, AUDIO_TOO_LONG for files over 30 seconds, ABORTED on cancellation, or UNSUPPORTED_ENVIRONMENT when Web Audio is unavailable.

      Channels are averaged equally and resampled with Web Audio. This function never truncates long files. Cancellation closes the live context promptly and discards late output; a bounded offline render may finish before its source can be disconnected.

      import { decodeAudio } from '@tiny-stt/whistle/audio';
      async function decodeSelection(file: File) {
      return decodeAudio(file);
      }