public final class SynthesisRequest
extends Object



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 TextToSpeech.setLanguage instead of TextToSpeech.setVoice
  • 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 TextToSpeech.speak and TextToSpeech.synthesizeToFile.

Summary

Public constructors

SynthesisRequest(CharSequence text, Bundle params)
SynthesisRequest(String 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.

Inherited methods

From class java.lang.Object

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public constructors

SynthesisRequest

public SynthesisRequest (CharSequence text, 
                Bundle params)
Parameters
text CharSequence
params Bundle

SynthesisRequest

public SynthesisRequest (String text, 
                Bundle params)
Parameters
text String
params Bundle

Public methods

getCallerUid

public int getCallerUid ()

Gets the request caller Uid.

Returns
int

getCharSequenceText

public CharSequence getCharSequenceText ()

Gets the text which should be synthesized.

Returns
CharSequence

getCountry

public String getCountry ()

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

Returns
String

getLanguage

public String getLanguage ()

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

Returns
String

getParams

public Bundle getParams ()

Gets the additional params, if any.

Returns
Bundle

getPitch

public int getPitch ()

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

Returns
int

getSpeechRate

public int getSpeechRate ()

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

Returns
int

getText

public String getText ()

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

getVariant

public String getVariant ()

Gets the language variant to use.

Returns
String

getVoiceName

public String getVoiceName ()

Gets the name of the voice to use.

Returns
String

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2025-02-10 UTC.