An instance of a text-to-speech adapter.

Remarks

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

Hierarchy (view full)

Constructors

Properties

label: string = 'soniox.TTS'

Accessors

  • get capabilities(): TTSCapabilities
  • Returns this TTS's capabilities

    Returns TTSCapabilities

  • get markup(): TTSMarkup
  • Access TTS markup capabilities (instructions for the LLM, text conversion).

    Returns TTSMarkup

  • get model(): string
  • Get the model name/identifier for this TTS instance.

    Returns string

    The model name if available, "unknown" otherwise.

    Remarks

    Plugins should override this property to provide their model information.

  • get numChannels(): number
  • Returns the channel count of audio frames returned by this TTS

    Returns number

  • get provider(): string
  • Get the provider name for this TTS instance.

    Returns string

    The provider name if available, "unknown" otherwise.

    Remarks

    Plugins should override this property to provide their provider information.

  • get sampleRate(): number
  • Returns the sample rate of audio frames returned by this TTS

    Returns number

Methods

  • Open the provider connection ahead of the first synthesis, so it does not pay for the handshake. Best effort and non-blocking. Called by the framework when an agent starts or resumes. Providers without a persistent connection need not override this.

    Returns void

  • Release idle pooled provider connections without closing the TTS.

    The framework calls this once nothing uses the TTS any more: every activity and session that uses an instance counts as a user, and the last one to close, or an Agent.updateOptions that swaps the instance out, triggers the release. Those connections would otherwise sit idle until the process exits. Nothing in flight is interrupted: an in-flight synthesis keeps its connection, which then closes when it finishes instead of rejoining the pool. The TTS stays usable and reconnects on the next synthesis. Providers without a connection pool need not override this.

    Returns Promise<void>