Class TextToSpeech

The TextToSpeech class provides functionalities for converting text to speech using the TikTok and Deepgram APIs.

Constructors

Properties

Methods

Constructors

  • Constructs a new TextToSpeech instance.

    Parameters

    • components: TTSComponents

      Components to initialize the TextToSpeech instance.

    Returns TextToSpeech

    If API key or SessionID is missing.

Properties

apiToken: string

API token for authentication with the text-to-speech services

logger: boolean

Flag to enable or disable logging

sessionId: string

Session ID for TikTok text-to-speech API

Methods

  • Generates speech audio from the provided text using the specified API.

    Parameters

    • args: CreateSpeech

      Arguments for generating the speech.

    Returns Promise<undefined | string>

    A Promise that resolves to the file path of the generated audio file or undefined if an error occurs.