Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Programmatically Change TTS Default Engine

In addition to the Pico TTS engine that comes with Android, I have another TTS engine installed. I can change which is the default used by the system -- manually:

Settings > Voice input & output > Text-to-speech settings > Default Engine

I would like to be able to do that programmatically, from within my application. Is this possible?

If so, how would I go about that?

like image 543
an00b Avatar asked Sep 09 '11 13:09

an00b


2 Answers

The above answer is no longer valid as the method is deprecated. Android API 14 and above you need to use the constructor for setting the engine.

TextToSpeech(Context context, TextToSpeech.OnInitListener listener, String engine)

The "engine" String is the package name of the TTS engine you want to use.

like image 77
Ishaan Avatar answered Nov 08 '22 01:11

Ishaan


You can't change the default engine. You can however, change the engine you are using by calling TextToSpeech.setEngineByPackageName() (available since 2.2) or use the constructor that takes an engine package parameter (available in ICS, so not really useful right now).

There is also no API before ICS to find out what engines are installed, so you need to know the other engine's package beforehand to be able to use it.

like image 6
Nikolay Elenkov Avatar answered Nov 07 '22 23:11

Nikolay Elenkov