to top
Android APIs
Sample Code >

TtsEngine - Text To Speech Engine

← Back

This sample demonstrates how to create a text to speech engine that users can install on their devices.

The application includes a service and two activities:

  • RobotSpeakTtsService, a simple text to speech engine that converts sentences into audio by generating a square wave of a given frequency for each alphabet of a given language. Though this doesn't qualify as speech (except for robots) it exercises all aspects of the new text to speech API by subclassing the TextToSpeechService framework class.
  • CheckVoiceData, an activity that checks that all voice related data is installed and available.
  • RobotSpeakSettings, a settings screen for users to set various engine parameters. This is usually accessed by users from the system wide settings app. This must be declared in the AndroidManifest.xml file as a meta-data element.
  • Note that this API is supported only on Android 4.0 (API level 13) and higher versions of the platform.