|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectrita.RiObject
rita.RiSpeech
public class RiSpeech
Provides basic cross-platform text-to-speech facilities with control over a range of parameters including voice-selection, pitch, speed, rate, etc. When needed, multiple RiSpeech objects can be created, each with their own parameters, for concurrent speech.
Note: requires the installation of one or more FreeTTS compatible voices (see the RiTa+TTS install which includes a default 16-bit voice)...
To receive callbacks when a RiSpeech object has completed speaking a chunk of text, implement the following method in your applet:
void onRiTaEvent(RiTaEvent re) {
RiSpeech rs = (RiSpeech)re.getSource();
String lastSpokenText = re.getData();
...
}
Also compatible with mbrola voices (http://tcts.fpms.ac.be/synthesis/mbrola.html), but requires a local installation of the mbrola binary (which must be named 'mbrola'), as well as a call to:
RiSpeech.setMbrolaBase(String pathToMbrola);Specific instructions for installing and testing mbrola with RiTa can be found here.
Note: there is currently an incompatability w' FreeTTS and Mbrola on Mac OSX, but you can use the native MacTTS voices with code as follows:
RiSpeech rs = new RiSpeech(this);
rs.useMacTTS();
rs.setVoice("Bruce");
rs.speak("Hello");
The default voices included on the Mac are:
"Victoria", "Agnes", "Kathy", "Princess", "Vicki",
"Bruce", "Fred", "Junior", "Ralph", "Albert",
"Bad News", "Bahh", "Bells", "Boing", "Bubbles",
"Cellos", "Deranged", "Good News", "Hysterical",
"Pipe Organ", "Trinoids", "Whisper", "Zarvox"
| Field Summary |
|---|
| Fields inherited from interface processing.core.PConstants |
|---|
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z |
| Constructor Summary | |
|---|---|
RiSpeech()
Creates a new object for Text-To-Speech and enables TTS for the system (if possible) |
|
RiSpeech(processing.core.PApplet pApplet)
Creates a new object for Text-To-Speech and enables TTS for the system (if possible) |
|
RiSpeech(processing.core.PApplet pApplet,
java.lang.String voiceName)
Creates a new object for Text-To-Speech and enables TTS for the system (if possible), using the specified voice name. |
|
RiSpeech(processing.core.PApplet pApplet,
java.lang.String voiceName,
java.lang.String mbrolaBase)
Creates a new object for Text-To-Speech and enables TTS for the system using the specified voice name, and setting the optional property 'mbrola.base' to mbrolaBase. |
|
| Method Summary | |
|---|---|
void |
delete()
Cleans-up resources associated with the text-to-speech engine. |
void |
dispose()
Cleans-up resources on program end - not to be called in user-code. |
void |
fireSpeechCompletedEvent(java.lang.String text)
Creates dynamic callback to the parent PApplet implementing: |
java.lang.String[] |
getAvailableVoiceNames()
Returns the names for all currently available voices. |
java.lang.String |
getOutputFile()
Returns the current output filename of null if none is specified. |
java.lang.String |
getVoiceDescription()
Returns descriptive info on the current voice |
java.lang.String[] |
getVoiceDescriptions()
Returns the names and descriptions for each available voice. |
java.lang.String[] |
getVoiceInfo()
Deprecated. |
java.lang.String |
getVoiceName()
Returns a descriptive name for the current voice |
float |
getVoicePitch()
Returns the pitch of the current voice |
float |
getVoicePitchRange()
Returns the pitch range of the current voice |
float |
getVoicePitchShift()
Returns the pitch shift of the current voice |
float |
getVoiceRate()
Returns the rate of the current voice |
float |
getVoiceVolume()
Returns the volume of the current voice |
static boolean |
isTTSEnabled()
Returns whether Text-To-Speech is currently enabled |
boolean |
isUsingMacTTS()
Returns true if the speech engine is using the built-in Mac Speech API |
static void |
main(java.lang.String[] args)
|
void |
preload()
Loads all speech resources immediately (on initialization) to avoid any delays on the first utterance -- only necessary if there is a noticeable delay in program execution when speech begins. |
static void |
setMbrolaBase(java.lang.String mbrolaBase)
Enables support for mbrola voices by specifying the path to the installed mbrola binary. |
void |
setOutputFile(java.lang.String wavFileName)
Will direct output to a file instead of to the system's audio output. |
static void |
setTTSEnabled(boolean enableTts)
Set whether Text-To-Speech is currently enabled |
void |
setVoice(java.lang.String voiceDesc)
Sets the current voice by name (default voice='kevin') |
void |
setVoicePitch(float hertz)
Sets the pitch of the current voice |
void |
setVoicePitchRange(float range)
Sets the pitch range of the current voice |
void |
setVoicePitchShift(float shift)
Sets the pitch shift of the current voice |
void |
setVoiceRate(float wpm)
Sets the rate of the current voice |
void |
setVoiceVolume(float vol)
Sets the volume of the current voice |
void |
speak(RiString riString)
Speaks the text string contained in a RiString object using the current voice. |
void |
speak(RiText riText)
Speaks the text string contained in a RiText object using the current voice. |
void |
speak(java.lang.String text)
Speaks the text string using the current voice. |
void |
stop()
Stops the voice immediately if speaking. |
void |
useMacTTS()
Tells the object to use the built-in Mac Speech API for all subsequent utterances |
void |
useMacTTS(java.lang.String voice)
Tells the object to use the built-in Mac Speech API for all subsequent utterances, then sets the current voice to voice |
| Methods inherited from class rita.RiObject |
|---|
getId, getPApplet, nextId |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RiSpeech()
public RiSpeech(processing.core.PApplet pApplet)
public RiSpeech(processing.core.PApplet pApplet,
java.lang.String voiceName)
public RiSpeech(processing.core.PApplet pApplet,
java.lang.String voiceName,
java.lang.String mbrolaBase)
mbrolaBase.
| Method Detail |
|---|
public void dispose()
dispose in class RiObjectpublic java.lang.String getOutputFile()
public void setOutputFile(java.lang.String wavFileName)
public void preload()
public void fireSpeechCompletedEvent(java.lang.String text)
void onRiTaEvent(RiTaEvent re) {...}
public static boolean isTTSEnabled()
public static void setTTSEnabled(boolean enableTts)
enableTts - public java.lang.String[] getVoiceDescriptions()
public java.lang.String[] getAvailableVoiceNames()
public void speak(RiText riText)
public void speak(RiString riString)
public void speak(java.lang.String text)
public void delete()
public java.lang.String getVoiceName()
public java.lang.String getVoiceDescription()
public java.lang.String[] getVoiceInfo()
getVoiceDescriptions()public float getVoicePitch()
public float getVoicePitchRange()
public float getVoicePitchShift()
public void stop()
public float getVoiceRate()
public float getVoiceVolume()
public void setVoice(java.lang.String voiceDesc)
Additional 'mbrola' voices can also be enabled if the mbrola binary is installed and the 'mbrola.base' system property has been set by calling:
RiSpeech.setMbrolaBase("c:\\path\\to\\mbrola\\");
public static void setMbrolaBase(java.lang.String mbrolaBase)
Note: this method must be called before setting the current voice to an mbrola voice.
public void setVoicePitch(float hertz)
public void setVoicePitchRange(float range)
public void setVoicePitchShift(float shift)
public void setVoiceRate(float wpm)
public void setVoiceVolume(float vol)
public void useMacTTS()
public void useMacTTS(java.lang.String voice)
voice
public boolean isUsingMacTTS()
public static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||