Android APIs
public final class

SynthesisRequest

extends Object
java.lang.Object
   ↳ android.speech.tts.SynthesisRequest

Class Overview

Contains data required by engines to synthesize speech. This data is:

  • The text to synthesize
  • The synthesis locale, represented as a language, country and a variant. The language is an ISO 639-3 letter language code, and the country is an ISO 3166 alpha 3 code. The variant is not specified.
  • The name of the voice requested for this synthesis. May be empty if the client uses setLanguage(Locale) instead of setVoice(Voice)
  • The synthesis speech rate, with 100 being the normal, and higher values representing higher speech rates.
  • The voice pitch, with 100 being the default pitch.
Any additional parameters sent to the text to speech service are passed in uninterpreted, see the params argument in speak(CharSequence, int, Bundle, String) and synthesizeToFile(CharSequence, Bundle, File, String).

Summary

Public Constructors
SynthesisRequest(String text, Bundle params)
SynthesisRequest(CharSequence text, Bundle params)
Public Methods
int getCallerUid()
Gets the request caller Uid.
CharSequence getCharSequenceText()
Gets the text which should be synthesized.
String getCountry()
Gets the ISO 3-letter country code for the language to use.
String getLanguage()
Gets the ISO 3-letter language code for the language to use.
Bundle getParams()
Gets the additional params, if any.
int getPitch()
Gets the pitch to use.
int getSpeechRate()
Gets the speech rate to use.
String getText()
This method was deprecated in API level 21. As of API level 21, replaced by getCharSequenceText().
String getVariant()
Gets the language variant to use.
String getVoiceName()
Gets the name of the voice to use.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public SynthesisRequest (String text, Bundle params)

Added in API level 14

Parameters
text
params

public SynthesisRequest (CharSequence text, Bundle params)

Added in API level 21

Parameters
text
params

Public Methods

public int getCallerUid ()

Added in API level 19

Gets the request caller Uid.

Returns
int

public CharSequence getCharSequenceText ()

Added in API level 21

Gets the text which should be synthesized.

Returns
CharSequence

public String getCountry ()

Added in API level 14

Gets the ISO 3-letter country code for the language to use.

Returns
String

public String getLanguage ()

Added in API level 14

Gets the ISO 3-letter language code for the language to use.

Returns
String

public Bundle getParams ()

Added in API level 14

Gets the additional params, if any.

Returns
Bundle

public int getPitch ()

Added in API level 14

Gets the pitch to use. The normal pitch is 100.

Returns
int

public int getSpeechRate ()

Added in API level 14

Gets the speech rate to use. The normal rate is 100.

Returns
int

public String getText ()

Added in API level 14

This method was deprecated in API level 21.
As of API level 21, replaced by getCharSequenceText().

Gets the text which should be synthesized.

Returns
String

public String getVariant ()

Added in API level 14

Gets the language variant to use.

Returns
String

public String getVoiceName ()

Added in API level 21

Gets the name of the voice to use.

Returns
String