[Home]

Jailbreak Developer Network: JBSpeechClient


(Internal) Actor >> Info >> JBSpeech >> JBSpeechClient

Parses and interprets a speech sequence definition and plays it. See Implementation for implementation details.

Segmented Speech Sequences

Segmented speech sequences allow playback of complex announcements built on-the-fly from short, atomic segments. For example, consider the following samples:

No less than sixteen distinct, meaningful announcements can be created based on these eight short samples. With carefully crafted samples you might even be able to create a simple "text to speech" engine.

Sequence definition syntax

The Parse function takes a string argument which describes the sequence of sound samples to be played. In its simplest form, it's just a whitespace-separated list of sound object names. You can specify sound segments as follows:

SoundName
Plays the sound object named SoundName from the user's currently selected Jailbreak voice pack.
Package.SoundName
Plays the sound object named SoundName from the package Package, ignoring the user's currently selected Jailbreak or UT2004 voice pack.
Type/Announcement
Plays the specified announcement from the player's currently selected UT2004 voice pack. Type can bei either Reward or Status, depending on the type of announcement you want to play. (Figuring out the actual names of the announcements is left as an exercise to the reader.)

In addition to references to sound objects, you can also add the following control sequences:

(tag: ...)
Conditional sub-sequence; can be nested. The sequence following the colon within the parentheses is played only if the tag is included in the comma-separated tag list passed as the Tags parameter to the Parse function. Tags are case-insensitive.
+...ms
+...%
Inserts a pause before playing the next sound in the sequence. If a percentage is given, it relates to the duration of the last sound segment which was played.
-...ms
-...%
Inserts a "negative pause" before playing the next sound in the sequence; in other words, the next sound overlaps the one preceding it. As the entire sequence definition is parsed at once before anything is played, you can completely reorder the time line of sounds played if you like.
@...ms
Moves the time pointer to the specified time so that the next sound segment will be played at exactly that time. It is possible to use a percentage with this statement as well, but it still only relates to the duration of last sound played, not the total (as that would be a circular relationship).

Whitespace between tokens is generally ignored other than serving as a token separator. The parser dumps a diagnostic error message into the log file when a syntax error is encountered.

Examples

TheRedTeam HasBeenCaptured
Plays exactly those two samples one after the other, subject to the DefaultPackage and DefaultPause configuration settings in JBSpeechManager.
(red: TheRedTeam) (blue: TheBlueTeam) (capture: HasBeenCaptured) (release: HasBeenReleased)
Combines four meaningful announcements (The red/blue team has been captured/released) in a single sequence definition, provided that the tags red / blue and capture / release are "set" meaningfully by being included in the Tags argument when calling the Parse function.
Three @1000ms Two @2000ms One @3000ms Reward/Headshot
Plays a (precisely timed) countdown ending in the "head shot!" announcement.
@2000ms One @1000ms Two @0ms Three @3000ms Reward/Headshot
Exactly the same as before. You can completely redefine the sequence timeline with +, - or @ if you like if it makes sense to you.
ProcessingCode +1000ms GameSounds.CTFAlarm -100% IntruderAlert IntruderAlert
Plays Processing code, waits a second, then sounds an alarm (taken from the GameSounds package rather than the one defined in DefaultPackage) at the same time as playing Intruder alert! twice in a row.