Overview | Package | Class | Tree | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class javax.speech.synthesis.Voice

java.lang.Object
  |
  +--javax.speech.synthesis.Voice

public class Voice
extends Object
implements Cloneable
A description of one output voice of a speech synthesizer. Voice objects can be used in selection of synthesis engines (through the SynthesizerModeDesc). The current speaking voice of a Synthesizer can be changed during operation with the setVoice method of the SynthesizerProperties object.

See Also:
SynthesizerModeDesc, setVoice, Synthesizer

Field Summary
static int AGE_CHILD
          Age roughly up to 12 years.
static int AGE_DONT_CARE
          Ignore age when performing a match.
static int AGE_MIDDLE_ADULT
          Age roughly 40 to 60 years.
static int AGE_NEUTRAL
          Voice with age that is indeterminate.
static int AGE_OLDER_ADULT
          Age roughly 60 years and up.
static int AGE_TEENAGER
          Age roughly 13 to 19 years.
static int AGE_YOUNGER_ADULT
          Age roughly 20 to 40 years.
static int GENDER_DONT_CARE
          Ignore gender when performing a match of voices.
static int GENDER_FEMALE
          Female voice.
static int GENDER_MALE
          Male voice.
static int GENDER_NEUTRAL
          Neutral voice that is neither male or female (for example, artificial voices, robotic voices).
 
Constructor Summary
Voice()
          Empty constructor sets voice name and style to null, and age and gender to "don't care" values.
Voice(String name, int gender, int age, String style)
          Constructor provided with voice name, gender, age and style.
 
Method Summary
Object clone()
          Create a copy of this Voice.
boolean equals(Object anObject)
          Returns true if and only if the parameter is not null and is a Voice with equal values of name, age, gender, and style.
int getAge()
          Get the voice age.
int getGender()
          Get the voice gender.
String getName()
          Get the voice name.
String getStyle()
          Set the voice style.
boolean match(Voice require)
          Determine whether a Voice has all the features defined in the require object.
void setAge(int age)
          Set the voice age.
void setGender(int gender)
          Set the voice gender.
void setName(String name)
          Set the voice name.
void setStyle(String style)
          Set the voice style.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

GENDER_DONT_CARE

public static final int GENDER_DONT_CARE
Ignore gender when performing a match of voices. Synthesizers never provide a voice with GENDER_DONT_CARE.

See Also:
getGender, setGender

GENDER_FEMALE

public static final int GENDER_FEMALE
Female voice.

See Also:
getGender, setGender

GENDER_MALE

public static final int GENDER_MALE
Male voice.

See Also:
getGender, setGender

GENDER_NEUTRAL

public static final int GENDER_NEUTRAL
Neutral voice that is neither male or female (for example, artificial voices, robotic voices).

See Also:
getGender, setGender

AGE_DONT_CARE

public static final int AGE_DONT_CARE
Ignore age when performing a match. Synthesizers never provide a voice with AGE_DONT_CARE.

See Also:
getAge, setAge

AGE_CHILD

public static final int AGE_CHILD
Age roughly up to 12 years.

See Also:
getAge, setAge

AGE_TEENAGER

public static final int AGE_TEENAGER
Age roughly 13 to 19 years.

See Also:
getAge, setAge

AGE_YOUNGER_ADULT

public static final int AGE_YOUNGER_ADULT
Age roughly 20 to 40 years.

See Also:
getAge, setAge

AGE_MIDDLE_ADULT

public static final int AGE_MIDDLE_ADULT
Age roughly 40 to 60 years.

See Also:
getAge, setAge

AGE_OLDER_ADULT

public static final int AGE_OLDER_ADULT
Age roughly 60 years and up.

See Also:
getAge, setAge

AGE_NEUTRAL

public static final int AGE_NEUTRAL
Voice with age that is indeterminate. For example, artificial voices, robotic voices.

See Also:
getAge, setAge
Constructor Detail

Voice

public Voice()
Empty constructor sets voice name and style to null, and age and gender to "don't care" values.

Voice

public Voice(String name,
             int gender,
             int age,
             String style)
Constructor provided with voice name, gender, age and style.
Method Detail

getName

public String getName()
Get the voice name. May return null.

setName

public void setName(String name)
Set the voice name. A null or "" string in voice match means don't care.

getGender

public int getGender()
Get the voice gender. Gender values are OR'able. For example, to test whether a voice is male and/or neutral:
    Voice voice = ...;
    Voice test = new Voice();
    test.setGender(Voice.GENDER_MALE | Voice.GENDER_NEUTRAL);
    if (voice.match(test)) ...
 
See Also:
GENDER_FEMALE, GENDER_MALE, GENDER_NEUTRAL, GENDER_DONT_CARE

setGender

public void setGender(int gender)
Set the voice gender.

See Also:
GENDER_FEMALE, GENDER_MALE, GENDER_NEUTRAL, GENDER_DONT_CARE

getAge

public int getAge()
Get the voice age. Age values are OR'able. For example, to test whether a voice is child or teenager (less than 20):
    Voice voice = ...;
    Voice test = new Voice();
    test.setAge(Voice.AGE_CHILD | Voice.AGE_TEENAGER);
    if (voice.match(test)) ...
 
See Also:
AGE_CHILD, AGE_TEENAGER, AGE_YOUNGER_ADULT, AGE_MIDDLE_ADULT, AGE_OLDER_ADULT, AGE_NEUTRAL, AGE_DONT_CARE

setAge

public void setAge(int age)
Set the voice age.

See Also:
AGE_CHILD, AGE_TEENAGER, AGE_YOUNGER_ADULT, AGE_MIDDLE_ADULT, AGE_OLDER_ADULT, AGE_NEUTRAL, AGE_DONT_CARE

getStyle

public String getStyle()
Set the voice style. This parameter is designed for human interpretation. Values might include "business", "casual", "robotic", "breathy".

setStyle

public void setStyle(String style)
Set the voice style.

clone

public Object clone()
Create a copy of this Voice.
Returns:
A copy of this
Overrides:
clone in class Object

match

public boolean match(Voice require)
Determine whether a Voice has all the features defined in the require object. Strings in require which are either null or zero-length ("") are ignored. All string comparisons are exact matches (case-sensitive).

GENDER_DONT_CARE and AGE_DONT_CARE values in the require object are ignored. The age and gender parameters are OR'ed: e.g. the required age can be AGE_TEENAGER | AGE_CHILD.


equals

public boolean equals(Object anObject)
Returns true if and only if the parameter is not null and is a Voice with equal values of name, age, gender, and style.
Overrides:
equals in class Object

Overview | Package | Class | Tree | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

JavaTM Speech API
Copyright 1997-1998 Sun Microsystems, Inc. All rights reserved
Send comments to javaspeech-comments@sun.com