Android Text-to-Speech simplified.
Speakerbox simplifies basic TextToSpeech tasks and adds new tools including muting and text substitution.
Speakerbox creates and manages a new instance of TextToSpeech for a given activity.
Speakerbox speakerbox = new Speakerbox(activity);
There is no need to create your own OnInitListener. If you pass text to Speakerbox before the TextToSpeech engine has finished initializing it will save the text and automatically play it once initialization is complete.
Synthesizing text to speech with Speakerbox is simple. The text will play immediately or once initialization is complete (see above).
Speakerbox speakerbox = new Speakerbox(activity);
speakerbox.play("Hi");
// Hi
Speakerbox adds the ability to mute/unmute spoken text.
Speakerbox speakerbox = new Speakerbox(activity);
speakerbox.mute();
speakerbox.play("Quiet please");
speakerbox.unmute();
spearkerbox.play("Cry out loud");
// Cry out loud
Substitute spoken text on the fly using the remix feature.
Speakerbox speakerbox = new Speakerbox(activity);
speakerbox.remix("min", "minutes");
speakerbox.play("The show starts in 5 min.");
// The show starts in 5 minutes.
Speakerbox will automatically shutdown the TextToSpeech engine and release its resources when the host activity is destroyed so you don't have to.
Download the latest JAR.
Include dependency using Maven.
<dependency>
<groupId>com.mapzen.android</groupId>
<artifactId>speakerbox</artifactId>
<version>1.4.1</version>
</dependency>
Include dependency using Gradle.
compile 'com.mapzen.android:speakerbox:1.4.1'