An instance of a text-to-speech response, as an asynchronous iterable iterator.

Example: Looping through frames

for await (const event of stream) {
await source.captureFrame(event.frame);
}

Remarks

This class is abstract, and as such cannot be used directly. Instead, use a provider plugin that exports its own child ChunkedStream class, which inherits this class's methods.

Hierarchy (view full)

Constructors

Properties

Accessors

Methods

Constructors

  • Parameters

    • ttsInstance: TTS
    • client: Mistral
    • opts: {
          expressiveness?: number;
          model: string;
          phonemeHints?: Record<string, IPAPhoneme[]>;
          refAudio?: string;
          responseFormat: SpeechOutputFormat;
          useRealtime: boolean;
          voice?: string;
      }
      • Optional expressiveness?: number
      • model: string
      • Optional phonemeHints?: Record<string, IPAPhoneme[]>
      • Optional refAudio?: string
      • responseFormat: SpeechOutputFormat
      • useRealtime: boolean
      • Optional voice?: string
    • text: string
    • Optional connOptions: APIConnectOptions
    • Optional abortSignal: AbortSignal

    Returns ChunkedStream

Properties

label: string = 'mistral.ChunkedStream'

Accessors

  • get abortSignal(): AbortSignal
  • Returns AbortSignal

  • get inputText(): string
  • Returns string

Methods

  • Close both the input and output of the TTS stream

    Returns void

  • Collect every frame into one in a single call

    Returns Promise<AudioFrame>