The speak-as property isn’t a complex control
mechanism, but definitely serves a useful role. Even if you are fluent with
phonetic alphabets, there’s a point where it doesn’t make sense to have to
define or write out every letter or number to ensure the engine doesn’t do the
wrong thing, and this is where the Speech module helps.
Where the module excels, however, is in providing playback control. But this is also an area where you may want to think twice before adding your own custom style sheet rules. Most reading systems typically have their own internal rules for playback so that the synthetic speech rendering doesn’t come out as one long uninterrupted stream of monotone narration. When you add your own rules, you have the potential to interfere with the reader’s default settings. But in the interests of thoroughness, we’ll take a quick tour.
The first stop is the ability to insert pauses. Pauses are an integral part of the synthetic speech reading process, as they provide a non-verbal indication of change. Without them, it wouldn’t always be clear if a new sentence were beginning or a new paragraph, or when one section ends and another begins.
The CSS3 Speech module includes a pause property
that allows you to control the duration to pause before and after any element.
For example, we could define a half-second pause before headings followed by a
quarter-second pause after by including the following rule:
h1 {
-epub-pause: 50ms 25ms
}
Aural cues are equally helpful when it comes to identifying new headings, as the
pause alone may not be interpreted by the listener as you expect. The Speech
module includes a cue property for exactly this
purpose:
h1 {
-epub-pause: 50ms 25ms;
-epub-cue: url('audio/ping.mp3') none
}
(Note that the addition of the none value after the
audio file location. If omitted, the cue would also sound after the heading was
finished.)
And finally, the rest property provides fine-grained
control when using cues. Cues occur after any initial pause before the element
(as defined by the pause property), and before any
pause after. But you may still want to control the pause that occurs between the
cue sounding and the text being read and between the end of the text being read
and the trailing cue sounding (i.e., so that the sound and the text aren’t run
together). The rest property is how you control the
duration of these pauses.