Skip to main content

Introduction

TextToSpeech SDK Overview​

The TextToSpeech SDK provides an API for synthesizing and playing text as speech. Third-party apps integrate with the Pleos Connect Speech Service through the TextToSpeech SDK. When a third-party app requests text-to-speech synthesis, the Speech Service processes it and plays the synthesized speech through the vehicle's audio system.

SDK version

This guide is based on TextToSpeech SDK v3.3.1.

Speech synthesis modes​

The TextToSpeech SDK provides the following three speech synthesis modes.

  • HYBRID: The default mode. It prioritizes server-based streaming TextToSpeech and automatically switches to the On-device engine if the network connection fails. App registration with My Project credentials from Pleos Playground is required.
  • SERVER: Uses server-based streaming TextToSpeech only. It requires a network connection and app registration. If the network connection fails, it does not switch to the On-device engine and instead delivers an error event.
  • ON_DEVICE: Runs streaming TextToSpeech on the vehicle's On-device engine. It does not require a network connection, and app registration is not required when using this mode only.

Entry point​

The ai.pleos.playground.tts.TextToSpeech class is the entry point for accessing TextToSpeech SDK features. Create an instance by passing the application Context and an operating Mode to the constructor. If you omit Mode, the SDK uses HYBRID.

A typical usage sequence is as follows.

  1. Create a TextToSpeech instance.
  2. Initialize the SDK with initialize().
  3. Register an event listener with addEventListener().
  4. If needed, set the synthesis language/region with setLocale().
  5. If using server-based synthesis modes (HYBRID, SERVER), complete app registration.
  6. In modes that require server connection, call speak() after OnServerConnectionListener.onConnected().
  7. When synthesis is done, call stop().
  8. After use, remove listeners with removeEventListener() and release resources with release().

Example: Create TextToSpeech instance​

import ai.pleos.playground.tts.TextToSpeech
import ai.pleos.playground.tts.constant.Mode

val textToSpeech = TextToSpeech(applicationContext, Mode.HYBRID)

Emulator setup​

To use the TextToSpeech SDK, install the Pleos Connect Emulator in Android Studio and configure an AVD.

  1. Check software development environment requirements
  2. Install the Pleos Connect Emulator
  3. Create and run an AVD
  4. Set up Pleos Connect Virtual Console
  5. Configure microphone access
  6. Configure cold boot

Next steps​

  1. Importing TextToSpeech SDK
  2. Declaring Permission
  3. SDK Initialization and Release
  4. Event Listeners
  5. Setting Locale
  6. App Registration
  7. Starting and Stopping Speech Synthesis
  8. Error Codes
  9. TextToSpeech API Reference