Member Junction
    Preparing search index...

    Function TranscribeAudioWithSplitting

    • Transcribes audio that may exceed a provider's upload ceiling, splitting it first when it does, and joins the pieces back into one transcript and one duration.

      Pieces are transcribed sequentially, not in parallel: transcription providers rate limit by audio-seconds per minute, so firing an hour of audio at once buys nothing but 429s, and a partial failure mid-way would leave a transcript with an unmarked hole in it.

      The returned durationSeconds is the sum across pieces, which is what the provider bills, and is left undefined if ANY piece failed to report one, since a partial sum would understate the bill while looking like a complete answer.

      A free function rather than a protected method so that BaseAudioGenerator (which keeps it as one, for its drivers) can still be assigned to BaseSpeechToText.

      Once cancellationToken aborts, no further piece is sent: the next piece throws a cancellation error (classified Cancelled) instead. The token is also handed to transcribeOne, which forwards it to its request so the piece in flight is torn down too.

      Parameters

      • audio: Buffer

        The full audio to transcribe

      • maxUploadBytes: number

        The provider's hard upload ceiling

      • splitTargetBytes: number

        Target piece size, below the ceiling to leave room for multipart framing

      • splitter: AudioSplitter

        Splitter to use for oversized audio; may be null, in which case oversized audio fails

      • providerLabel: string

        Provider name, used in the size-limit error messages

      • transcribeOne: (piece: Buffer, cancellationToken?: AbortSignal) => Promise<TranscriptionPiece>

        Transcribes a single piece already known to be within the ceiling

      • OptionalcancellationToken: AbortSignal

        Cancels the transcription between pieces, and is passed to each piece

      Returns Promise<TranscriptionPiece>