|
Have you heard the word? No, I mean it literally. Open
the Message panel and try this:
voiceSpeak("Director can talk!")
One of the major new features of Director MX is the
Speech Xtra. This is a small Xtra that is now a standard
part of Director and Shockwave, like the Text, Font,
Shockwave Audio, and 3D Xtras. It was added as part of
the new accessibility features in Director MX, which
also include a behavior library for captioning and keyboard
selection.
The uses of the Speech Xtra for accessibility are obvious—especially
to anyone who has ever had to build a government-related
project that adheres to Section
508. But the Speech Xtra isn't only for government
contractors. There are plenty of other uses for it as
well.
Using the Speech Xtra
What the Speech Xtra does, essentially, is to connect
to the text-to-speech system software on the user's
computer. Once connected, the Xtra sends the system
a string of text, which causes the system to speak
the text. Most computers today have text-to-speech
capability, even if the user doesn't know it. Anyone
on a Macintosh or Windows XP system will almost certainly
have it.
To make your computer speak some text with Director
MX, all you need to do is type the text below into the
Message panel:
voiceSpeak("Hello World")
Technically, when writing scripts, you should first
use the voiceInitialize() function.
This will return a TRUE or FALSE value, indicating whether
the user's computer is capable of text-to-speech functionality.
You can use this result to tell the user that they need
to install their OS text-to-speech software before using
your product. Here is an example of a frame script that
handles this:
on exitFrame me
if voiceInitialize() then
go to frame "Start"
else
go to frame "Speech Problem Notice"
end if
end
Once you have established that the user has the text-to-speech
software installed, you can customize the way the speech
sounds by using the voiceSetRate, voiceSetPitch,
and voiceSetVolume commands.
There are also equivalent voiceGetRate, voiceGetPitch,
and voiceGetVolume functions.
Unfortunately, the values these commands and functions
use depends on which system you are running. So be sure
to experiment with your test machines if you plan on
using them.
You can also change the voice entirely. The voiceSet command
allows you to set the voice type. On Macintosh systems
there is usually a selection of twenty or so voices.
The default text-to-speech usually has only one, but
users can add more.
You can use the voiceGet command
to see which voice is currently set. This code example
returns a property list:
put voiceGet()
-- [#name: "Agnes", #age: "35", #gender: "Female",
#index: 1]
You can use the voiceGetAll() command
to get a list of all of the voices available to that
user. When you use voiceSet,
you should pass it the index number of the voice as it
appears in the voiceGetAll() list.
You can use this functionality to provide a "Next
Voice" button—or perhaps a screen with a whole
list of voices and attributes that the user can choose
from.
But if you are not ready for this kind of Lingo programming,
you can just stick to using voiceInitialize and voiceSpeak.
Ten Uses For the Speech Xtra
Outside of its intended use as an accessibility feature,
I've come up with ten other uses for the Speech Xtra.
Most of these take advantage of the fact that you can
incorporate the Speech Xtra into your project and make
it speak some basic text without significantly increasing
development time or file size.
| 1 |
Welcome Users
When your presentation, application or game starts,
you can greet the user with a welcoming message.
You can introduce them to the product and even
tell them how to begin using it. For example,
you might have the Speech Xtra say:
"Hello and welcome to the DirMX Airlines
luggage lost and found kiosk. Press the begin button
to start."
|
| 2 |
Narration
If you are creating a simple presentation, why not
have some text spoken on every slide. This could
turn a live presentation into something that can
be used without a presenter. Without the Speech
Xtra, you would have to record large sound files
for every slide—but with the Xtra all you
need to do is type some text. |
| 3 |
Instructions
In games and other applications, it is usually
necessary to provide instructions. But most users
will skip them and many art directors hate to
include a boring page of text. So why not have
your "Instructions" button simply use
the Speech Xtra to tell the user how to play
the game?
|
| 4 |
Key
Press and Button Feedback
Buttons often make clicking sounds or beeps to let
the user know they have made a selection. But key
presses are usually silent. If you are creating a
hangman game, or something that requires the user
to choose a letter, you can easily add a voiceSpeak(the
key) to the on
keyUp handler to provide this feedback.
For that matter, you can also use the Speech Xtra
to provide button feedback, such as: "Option
1 selected." |
| 5 |
Audible
Alerts
Hate the alert box in Director? It's one of the few
features that hasn't changed since the early days.
But why not skip it altogether now and speak the
alerts instead? |
| 6 |
Debugging
Many developers, including myself, use alert boxes
and text members to relay information while a movie
is running for debugging purposes. The Speech Xtra
can be used for this purpose too, and you don't
need to make a whole new member and put it in a
sprite, or freeze the movie playback. |
| 7 |
Kiosk Prompts
Kiosk developers have to deal with periods of inactivity,
when the system doesn't encounter any mouse or
keyboard movement. In many cases, it is important
to identify whether this inactive state has occurred
because the user has walked away, or because the
user is currently studying the information on the
screen. Usually, a kiosk will reset itself after
a short duration of inactivity. With a simple voiceSpeak
command, you can warn a potential kiosk user before
this happens. And you can do so without invoking
an ugly alert box or other visual device. |
| 8 |
Educational
Applications for Pre-Readers
When making educational games, a strange thing happens
when the target audience gets to be very young—they
can't read! The new generation includes a group of
very young kids that are adept at using a mouse,
but can't read what's on the screen yet. Making educational
games for kids this age is a challenge, since you
can't use text. Usually, this type of project would
involve recording large sound files. But with the
Speech Xtra, you could streamline this process. If
you combine spoken text and on-screen text, you might
even be able to use the Speech Xtra to help kids
learn how to read. |
| 9 |
Pronunciation Guides
While the Speech Xtra doesn't really sound like
a real person, it can still be used to help people
pronounce difficult words in a text presentation.
You could use the hyperlinks functionality in
Director to link a word to a script which then
speaks the text.
One thing to be aware of: computer text-to-speech
doesn't always pronounce words correctly. Sometimes
you need to use voiceSpeak command
with a word spelled phonically, in order to hear
the desired pronunciation. Try entering this code
into the Message panel:
voiceSpeak("Gobbledygook")
voiceSpeak("Gobble-de-gewk")
|
| 10 |
Easter Eggs
People love finding hidden Easter eggs in software—and
it's all about making the user happy, right? An
easy way to create an Easter egg is to attach simple voiceSpeak commands
to graphics that are not even supposed to be buttons.
For instance, the Macromedia logo on the credits
page could have this script attached:
on mouseUp
voiceSpeak("Director MX rocks")
end
|
|