FileDocCategorySizeDatePackage
Voice.javaAPI DocAndroid 5.1 API7943Thu Mar 12 22:22:10 GMT 2015android.speech.tts

Voice

public class Voice extends Object implements android.os.Parcelable
Characteristics and features of a Text-To-Speech Voice. Each TTS Engine can expose multiple voices for each locale, with different set of features.

Fields Summary
public static final int
QUALITY_VERY_LOW
Very low, but still intelligible quality of speech synthesis
public static final int
QUALITY_LOW
Low, not human-like quality of speech synthesis
public static final int
QUALITY_NORMAL
Normal quality of speech synthesis
public static final int
QUALITY_HIGH
High, human-like quality of speech synthesis
public static final int
QUALITY_VERY_HIGH
Very high, almost human-indistinguishable quality of speech synthesis
public static final int
LATENCY_VERY_LOW
Very low expected synthesizer latency (< 20ms)
public static final int
LATENCY_LOW
Low expected synthesizer latency (~20ms)
public static final int
LATENCY_NORMAL
Normal expected synthesizer latency (~50ms)
public static final int
LATENCY_HIGH
Network based expected synthesizer latency (~200ms)
public static final int
LATENCY_VERY_HIGH
Very slow network based expected synthesizer latency (> 200ms)
private final String
mName
private final Locale
mLocale
private final int
mQuality
private final int
mLatency
private final boolean
mRequiresNetworkConnection
private final Set
mFeatures
public static final Parcelable.Creator
CREATOR
Constructors Summary
public Voice(String name, Locale locale, int quality, int latency, boolean requiresNetworkConnection, Set features)


      
             
             
             
             
              
        this.mName = name;
        this.mLocale = locale;
        this.mQuality = quality;
        this.mLatency = latency;
        this.mRequiresNetworkConnection = requiresNetworkConnection;
        this.mFeatures = features;
    
private Voice(android.os.Parcel in)

        this.mName = in.readString();
        this.mLocale = (Locale)in.readSerializable();
        this.mQuality = in.readInt();
        this.mLatency = in.readInt();
        this.mRequiresNetworkConnection = (in.readByte() == 1);
        this.mFeatures = new HashSet<String>();
        Collections.addAll(this.mFeatures, in.readStringArray());
    
Methods Summary
public intdescribeContents()

        return 0;
    
public booleanequals(java.lang.Object obj)

        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        Voice other = (Voice) obj;
        if (mFeatures == null) {
            if (other.mFeatures != null) {
                return false;
            }
        } else if (!mFeatures.equals(other.mFeatures)) {
            return false;
        }
        if (mLatency != other.mLatency) {
            return false;
        }
        if (mLocale == null) {
            if (other.mLocale != null) {
                return false;
            }
        } else if (!mLocale.equals(other.mLocale)) {
            return false;
        }
        if (mName == null) {
            if (other.mName != null) {
                return false;
            }
        } else if (!mName.equals(other.mName)) {
            return false;
        }
        if (mQuality != other.mQuality) {
            return false;
        }
        if (mRequiresNetworkConnection != other.mRequiresNetworkConnection) {
            return false;
        }
        return true;
    
public java.util.SetgetFeatures()
Returns the set of features it supports for a given voice. Features can either be framework defined, e.g. {@link TextToSpeech.Engine#KEY_FEATURE_NETWORK_TIMEOUT_MS} or engine specific. Engine specific keys must be prefixed by the name of the engine they are intended for. These keys can be used as parameters to {@link TextToSpeech#speak(String, int, java.util.HashMap)} and {@link TextToSpeech#synthesizeToFile(String, java.util.HashMap, String)}. Features values are strings and their values must met restrictions described in their documentation.

return
Set instance. May return {@code null} on error.

        return mFeatures;
    
public intgetLatency()

return
The voice's latency (lower is better)
see
#LATENCY_VERY_LOW
see
#LATENCY_LOW
see
#LATENCY_NORMAL
see
#LATENCY_HIGH
see
#LATENCY_VERY_HIGH

        return mLatency;
    
public java.util.LocalegetLocale()

return
The voice's locale



             
       
        return mLocale;
    
public java.lang.StringgetName()

return
Unique voice name.

        return mName;
    
public intgetQuality()

return
The voice's quality (higher is better)
see
#QUALITY_VERY_HIGH
see
#QUALITY_HIGH
see
#QUALITY_NORMAL
see
#QUALITY_LOW
see
#QUALITY_VERY_LOW

        return mQuality;
    
public inthashCode()

        final int prime = 31;
        int result = 1;
        result = prime * result + ((mFeatures == null) ? 0 : mFeatures.hashCode());
        result = prime * result + mLatency;
        result = prime * result + ((mLocale == null) ? 0 : mLocale.hashCode());
        result = prime * result + ((mName == null) ? 0 : mName.hashCode());
        result = prime * result + mQuality;
        result = prime * result + (mRequiresNetworkConnection ? 1231 : 1237);
        return result;
    
public booleanisNetworkConnectionRequired()

return
Does the Voice require a network connection to work.

        return mRequiresNetworkConnection;
    
public java.lang.StringtoString()

        StringBuilder builder = new StringBuilder(64);
        return builder.append("Voice[Name: ").append(mName)
                .append(", locale: ").append(mLocale)
                .append(", quality: ").append(mQuality)
                .append(", latency: ").append(mLatency)
                .append(", requiresNetwork: ").append(mRequiresNetworkConnection)
                .append(", features: ").append(mFeatures.toString())
                .append("]").toString();
    
public voidwriteToParcel(android.os.Parcel dest, int flags)

        dest.writeString(mName);
        dest.writeSerializable(mLocale);
        dest.writeInt(mQuality);
        dest.writeInt(mLatency);
        dest.writeByte((byte) (mRequiresNetworkConnection ? 1 : 0));
        dest.writeStringList(new ArrayList<String>(mFeatures));