FileDocCategorySizeDatePackage
SynthesisRequest.javaAPI DocAndroid 5.1 API4377Thu Mar 12 22:22:10 GMT 2015android.speech.tts

SynthesisRequest

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 {@link TextToSpeech#setLanguage} instead of {@link 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 {@code params} argument in {@link TextToSpeech#speak} and {@link TextToSpeech#synthesizeToFile}.

Fields Summary
private final CharSequence
mText
private final android.os.Bundle
mParams
private String
mVoiceName
private String
mLanguage
private String
mCountry
private String
mVariant
private int
mSpeechRate
private int
mPitch
private int
mCallerUid
Constructors Summary
public SynthesisRequest(String text, android.os.Bundle params)

        mText = text;
        // Makes a copy of params.
        mParams = new Bundle(params);
    
public SynthesisRequest(CharSequence text, android.os.Bundle params)

        mText = text;
        // Makes a copy of params.
        mParams = new Bundle(params);
    
Methods Summary
public intgetCallerUid()
Gets the request caller Uid.

        return mCallerUid;
    
public java.lang.CharSequencegetCharSequenceText()
Gets the text which should be synthesized.

        return mText;
    
public java.lang.StringgetCountry()
Gets the ISO 3-letter country code for the language to use.

        return mCountry;
    
public java.lang.StringgetLanguage()
Gets the ISO 3-letter language code for the language to use.

        return mLanguage;
    
public android.os.BundlegetParams()
Gets the additional params, if any.

        return mParams;
    
public intgetPitch()
Gets the pitch to use. The normal pitch is 100.

        return mPitch;
    
public intgetSpeechRate()
Gets the speech rate to use. The normal rate is 100.

        return mSpeechRate;
    
public java.lang.StringgetText()
Gets the text which should be synthesized.

deprecated
As of API level 21, replaced by {@link #getCharSequenceText}.

        return mText.toString();
    
public java.lang.StringgetVariant()
Gets the language variant to use.

        return mVariant;
    
public java.lang.StringgetVoiceName()
Gets the name of the voice to use.

        return mVoiceName;
    
voidsetCallerUid(int uid)
Sets Caller Uid

        mCallerUid = uid;
    
voidsetLanguage(java.lang.String language, java.lang.String country, java.lang.String variant)
Sets the locale for the request.

        mLanguage = language;
        mCountry = country;
        mVariant = variant;
    
voidsetPitch(int pitch)
Sets the pitch.

        mPitch = pitch;
    
voidsetSpeechRate(int speechRate)
Sets the speech rate.

        mSpeechRate = speechRate;
    
voidsetVoiceName(java.lang.String voiceName)
Sets the voice name for the request.

        mVoiceName = voiceName;