# SynthesisRequest

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary: [Ctors](https://developer.android.com/reference/android/speech/tts/SynthesisRequest#pubctors) \| [Methods](https://developer.android.com/reference/android/speech/tts/SynthesisRequest#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/speech/tts/SynthesisRequest#inhmethods)  

# SynthesisRequest

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/speech/tts/SynthesisRequest "View this page in Kotlin") \|Java


`
public

final

class
SynthesisRequest
`


`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


`

`


`

|---|-------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.speech.tts.SynthesisRequest |

<br />

*** ** * ** ***

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](https://developer.android.com/reference/android/speech/tts/TextToSpeech#setLanguage(java.util.Locale)) instead of [TextToSpeech.setVoice](https://developer.android.com/reference/android/speech/tts/TextToSpeech#setVoice(android.speech.tts.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 [TextToSpeech.speak](https://developer.android.com/reference/android/speech/tts/TextToSpeech#speak(java.lang.CharSequence,%20int,%20android.os.Bundle,%20java.lang.String)) and [TextToSpeech.synthesizeToFile](https://developer.android.com/reference/android/speech/tts/TextToSpeech#synthesizeToFile(java.lang.CharSequence,%20android.os.Bundle,%20android.os.ParcelFileDescriptor,%20java.lang.String)).

<br />

## Summary

|                                                                                                                                                           ### Public constructors                                                                                                                                                           ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[SynthesisRequest](https://developer.android.com/reference/android/speech/tts/SynthesisRequest#SynthesisRequest(java.lang.CharSequence,%20android.os.Bundle))`(`[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` text, `[Bundle](https://developer.android.com/reference/android/os/Bundle)` params) ` |
| ` `[SynthesisRequest](https://developer.android.com/reference/android/speech/tts/SynthesisRequest#SynthesisRequest(java.lang.String,%20android.os.Bundle))`(`[String](https://developer.android.com/reference/java/lang/String)` text, `[Bundle](https://developer.android.com/reference/android/os/Bundle)` params) `                   |

|                                                                                                                                                                                          ### Public methods                                                                                                                                                                                           ||
|-----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` int`                                                                            | ` `[getCallerUid](https://developer.android.com/reference/android/speech/tts/SynthesisRequest#getCallerUid())`() ` Gets the request caller Uid.                                                                                                                                                                    |
| ` `[CharSequence](https://developer.android.com/reference/java/lang/CharSequence) | ` `[getCharSequenceText](https://developer.android.com/reference/android/speech/tts/SynthesisRequest#getCharSequenceText())`() ` Gets the text which should be synthesized.                                                                                                                                        |
| ` `[String](https://developer.android.com/reference/java/lang/String)             | ` `[getCountry](https://developer.android.com/reference/android/speech/tts/SynthesisRequest#getCountry())`() ` Gets the ISO 3-letter country code for the language to use.                                                                                                                                         |
| ` `[String](https://developer.android.com/reference/java/lang/String)             | ` `[getLanguage](https://developer.android.com/reference/android/speech/tts/SynthesisRequest#getLanguage())`() ` Gets the ISO 3-letter language code for the language to use.                                                                                                                                      |
| ` `[Bundle](https://developer.android.com/reference/android/os/Bundle)            | ` `[getParams](https://developer.android.com/reference/android/speech/tts/SynthesisRequest#getParams())`() ` Gets the additional params, if any.                                                                                                                                                                   |
| ` int`                                                                            | ` `[getPitch](https://developer.android.com/reference/android/speech/tts/SynthesisRequest#getPitch())`() ` Gets the pitch to use.                                                                                                                                                                                  |
| ` int`                                                                            | ` `[getSpeechRate](https://developer.android.com/reference/android/speech/tts/SynthesisRequest#getSpeechRate())`() ` Gets the speech rate to use.                                                                                                                                                                  |
| ` `[String](https://developer.android.com/reference/java/lang/String)             | ` `[getText](https://developer.android.com/reference/android/speech/tts/SynthesisRequest#getText())`() ` *This method was deprecated in API level 21. As of API level 21, replaced by [getCharSequenceText()](https://developer.android.com/reference/android/speech/tts/SynthesisRequest#getCharSequenceText()).* |
| ` `[String](https://developer.android.com/reference/java/lang/String)             | ` `[getVariant](https://developer.android.com/reference/android/speech/tts/SynthesisRequest#getVariant())`() ` Gets the language variant to use.                                                                                                                                                                   |
| ` `[String](https://developer.android.com/reference/java/lang/String)             | ` `[getVoiceName](https://developer.android.com/reference/android/speech/tts/SynthesisRequest#getVoiceName())`() ` Gets the name of the voice to use.                                                                                                                                                              |

| ### Inherited methods |
|-----------------------|---|
| From class ` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                        | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                             | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                            | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this `Object`.                                                                                                                                                 | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                   | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                              | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                           | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                              | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(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](https://developer.android.com/reference/java/lang/Object#wait(long))`(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](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.                                                                                             | ||

## Public constructors

### SynthesisRequest

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

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

<br />

<br />

|           Parameters            ||
|----------|-----------------------|
| `text`   | `CharSequence` <br /> |
| `params` | `Bundle` <br />       |

### SynthesisRequest

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

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

<br />

<br />

|        Parameters         ||
|----------|-----------------|
| `text`   | `String` <br /> |
| `params` | `Bundle` <br /> |

## Public methods

### getCallerUid

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getCallerUid ()
```

Gets the request caller Uid.

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### getCharSequenceText

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CharSequence getCharSequenceText ()
```

Gets the text which should be synthesized.

<br />

|                                        Returns                                         ||
|--------------------------------------------------------------------------------|--------|
| [CharSequence](https://developer.android.com/reference/java/lang/CharSequence) | <br /> |

### getCountry

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String getCountry ()
```

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

<br />

|                                  Returns                                   ||
|--------------------------------------------------------------------|--------|
| [String](https://developer.android.com/reference/java/lang/String) | <br /> |

### getLanguage

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String getLanguage ()
```

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

<br />

|                                  Returns                                   ||
|--------------------------------------------------------------------|--------|
| [String](https://developer.android.com/reference/java/lang/String) | <br /> |

### getParams

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Bundle getParams ()
```

Gets the additional params, if any.

<br />

|                                   Returns                                   ||
|---------------------------------------------------------------------|--------|
| [Bundle](https://developer.android.com/reference/android/os/Bundle) | <br /> |

### getPitch

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getPitch ()
```

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

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### getSpeechRate

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public int getSpeechRate ()
```

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

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### getText

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String getText ()
```


**This method was deprecated
in API level 21.**   

As of API level 21, replaced by [getCharSequenceText()](https://developer.android.com/reference/android/speech/tts/SynthesisRequest#getCharSequenceText()).

Gets the text which should be synthesized.

<br />

|                                  Returns                                   ||
|--------------------------------------------------------------------|--------|
| [String](https://developer.android.com/reference/java/lang/String) | <br /> |

### getVariant

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String getVariant ()
```

Gets the language variant to use.

<br />

|                                  Returns                                   ||
|--------------------------------------------------------------------|--------|
| [String](https://developer.android.com/reference/java/lang/String) | <br /> |

### getVoiceName

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String getVoiceName ()
```

Gets the name of the voice to use.

<br />

|                                  Returns                                   ||
|--------------------------------------------------------------------|--------|
| [String](https://developer.android.com/reference/java/lang/String) | <br /> |