Stay organized with collections
Save and categorize content based on your preferences.
SynthesisRequest
class SynthesisRequest
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 android.speech.tts.TextToSpeech#speak and android.speech.tts.TextToSpeech#synthesizeToFile.
Summary
Public methods |
Int |
Gets the request caller Uid.
|
CharSequence! |
Gets the text which should be synthesized.
|
String! |
Gets the ISO 3-letter country code for the language to use.
|
String! |
Gets the ISO 3-letter language code for the language to use.
|
Bundle! |
Gets the additional params, if any.
|
Int |
Gets the pitch to use.
|
Int |
Gets the speech rate to use.
|
String! |
Gets the text which should be synthesized.
|
String! |
Gets the language variant to use.
|
String! |
Gets the name of the voice to use.
|
Public constructors
SynthesisRequest
SynthesisRequest(
text: String!,
params: Bundle!)
Public methods
getCallerUid
fun getCallerUid(): Int
Gets the request caller Uid.
getCharSequenceText
fun getCharSequenceText(): CharSequence!
Gets the text which should be synthesized.
getCountry
fun getCountry(): String!
Gets the ISO 3-letter country code for the language to use.
getLanguage
fun getLanguage(): String!
Gets the ISO 3-letter language code for the language to use.
getParams
fun getParams(): Bundle!
Gets the additional params, if any.
getPitch
fun getPitch(): Int
Gets the pitch to use. The normal pitch is 100.
getSpeechRate
fun getSpeechRate(): Int
Gets the speech rate to use. The normal rate is 100.
getText
fun getText(): String!
Deprecated: As of API level 21, replaced by getCharSequenceText
.
Gets the text which should be synthesized.
getVariant
fun getVariant(): String!
Gets the language variant to use.
getVoiceName
fun getVoiceName(): String!
Gets the name of the voice to use.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# SynthesisRequest\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nSynthesisRequest\n================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/speech/tts/SynthesisRequest \"View this page in Java\") \n\n```\nclass SynthesisRequest\n```\n\n|---|------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.speech.tts.SynthesisRequest](#) |\n\nContains data required by engines to synthesize speech. This data is:\n\n- The text to synthesize\n- 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.\n- The name of the voice requested for this synthesis. May be empty if the client uses [TextToSpeech.setLanguage](/reference/kotlin/android/speech/tts/TextToSpeech#setLanguage(java.util.Locale)) instead of [TextToSpeech.setVoice](/reference/kotlin/android/speech/tts/TextToSpeech#setVoice(android.speech.tts.Voice))\n- The synthesis speech rate, with 100 being the normal, and higher values representing higher speech rates.\n- The voice pitch, with 100 being the default pitch.\n\nAny additional parameters sent to the text to speech service are passed in uninterpreted, see the `params` argument in android.speech.tts.TextToSpeech#speak and android.speech.tts.TextToSpeech#synthesizeToFile.\n\n\u003cbr /\u003e\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [SynthesisRequest](#SynthesisRequest(kotlin.CharSequence,%20android.os.Bundle))`(`text:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!`, `params:` `[Bundle](../../os/Bundle.html#)!`)` \u003cbr /\u003e |\n| [SynthesisRequest](#SynthesisRequest(kotlin.String,%20android.os.Bundle))`(`text:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`, `params:` `[Bundle](../../os/Bundle.html#)!`)` \u003cbr /\u003e |\n\n| Public methods ||\n|------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getCallerUid](#getCallerUid())`()` Gets the request caller Uid. |\n| [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)! | [getCharSequenceText](#getCharSequenceText())`()` Gets the text which should be synthesized. |\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getCountry](#getCountry())`()` Gets the ISO 3-letter country code for the language to use. |\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getLanguage](#getLanguage())`()` Gets the ISO 3-letter language code for the language to use. |\n| [Bundle](../../os/Bundle.html#)! | [getParams](#getParams())`()` Gets the additional params, if any. |\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getPitch](#getPitch())`()` Gets the pitch to use. |\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getSpeechRate](#getSpeechRate())`()` Gets the speech rate to use. |\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getText](#getText())`()` Gets the text which should be synthesized. |\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getVariant](#getVariant())`()` Gets the language variant to use. |\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getVoiceName](#getVoiceName())`()` Gets the name of the voice to use. |\n\nPublic constructors\n-------------------\n\n### SynthesisRequest\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nSynthesisRequest(\n text: CharSequence!, \n params: Bundle!)\n``` \n\n### SynthesisRequest\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nSynthesisRequest(\n text: String!, \n params: Bundle!)\n```\n\nPublic methods\n--------------\n\n### getCallerUid\n\nAdded in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getCallerUid(): Int\n```\n\nGets the request caller Uid. \n\n### getCharSequenceText\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getCharSequenceText(): CharSequence!\n```\n\nGets the text which should be synthesized. \n\n### getCountry\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getCountry(): String!\n```\n\nGets the ISO 3-letter country code for the language to use. \n\n### getLanguage\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getLanguage(): String!\n```\n\nGets the ISO 3-letter language code for the language to use. \n\n### getParams\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getParams(): Bundle!\n```\n\nGets the additional params, if any. \n\n### getPitch\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getPitch(): Int\n```\n\nGets the pitch to use. The normal pitch is 100. \n\n### getSpeechRate\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getSpeechRate(): Int\n```\n\nGets the speech rate to use. The normal rate is 100. \n\n### getText\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nDeprecated in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getText(): String!\n```\n\n**Deprecated:** *As of API level 21, replaced by [getCharSequenceText](#getCharSequenceText()).*\n\nGets the text which should be synthesized. \n\n### getVariant\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getVariant(): String!\n```\n\nGets the language variant to use. \n\n### getVoiceName\n\nAdded in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getVoiceName(): String!\n```\n\nGets the name of the voice to use."]]