Introduction
Overview
The TextToSpeech SDK provides an API for synthesizing and playing text as speech. Third-party apps integrate with the Speech Service of Pleos Connect through the TextToSpeech SDK. When a third-party app requests speech synthesis of text, the Speech Service processes it and plays the synthesized speech through the vehicle's audio system.
Entry point
The ai.pleos.playground.tts.TextToSpeech class is the entry point for accessing the TextToSpeech SDK features. Create an object by passing the application Context and execution Mode to the constructor. If Mode is omitted, HYBRID is applied.
SERVER: Uses only server-based streaming TextToSpeech. Requires network connection and app registration, and if the network connection fails, it does not switch to the On-device engine but delivers an error event. To use server-based synthesis, app registration with My Project credentials from Pleos Playground is required.ON_DEVICE: Executes Streaming TextToSpeech on the vehicle's On-device engine. Does not require a network connection and does not use server-based synthesis, so app registration is not necessary.HYBRID: The default mode. Prefers server-based streaming TextToSpeech, and if the network connection fails, the SDK automatically switches to the On-device engine. App registration with My Project credentials from Pleos Playground is required.
- Kotlin
- Java
import ai.pleos.playground.tts.TextToSpeech
import ai.pleos.playground.tts.constant.Mode
val textToSpeech = TextToSpeech(applicationContext, Mode.HYBRID)
import ai.pleos.playground.tts.TextToSpeech;
import ai.pleos.playground.tts.constant.Mode;
TextToSpeech textToSpeech =
new TextToSpeech(getApplicationContext(), Mode.HYBRID);
In the next steps, complete Importing the TextToSpeech SDK and Declaring Permissions before initializing the SDK.
Emulator setup
To use the TextToSpeech SDK, install the Pleos Connect Emulator in Android Studio and set up the AVD.