And as I mentioned in the overlays section, there are reading systems that already give word-level text-audio synchronization in synthetic speech playback mode, surpassing what most people would attempt with an overlay and human narration. As each word is fed for rendering it gets highlighted on the screen auto-magically; there’s nothing special you have to do.
The cost and effort to improve synthetic speech is also one that has the potential to decrease over time as you build re-usable lexicons and processes to enhance your books.
But enough selling of benefits. You undoubtedly want to know how EPUB 3 helps you, so let’s get on with the task.
The new specification adds three mechanisms specifically aimed at synthetic speech production: PLS lexicon files, SSML markup, and CSS3 Speech style sheets. We’ll go into each of these in turn and explore how you can now combine them to optimize the quality of your ebooks.
The first of the new synthetic speech enhancement layers we’ll look at is PLS files, which are xml lexicon files that conform to the W3C Pronunciation Lexicon Specification. The entries in these files identify the word(s) to apply each pronunciation rule to. The entries also include the correct phonetic spelling, which provides the text-to-speech engine with the proper pronunciation to render.
Perhaps a simpler way of thinking about PLS files, though, is as containing globally-applicable pronunciation rules: the entries you define in these files will be used for all matching cases in your content. Instead of having to add the pronunciation over and over every time the word is encountered in your markup, as SSML requires, these lexicons are used as global lookups.
PLS files are consequently the ideal place to define all the proper names and technical terms and other complex words that do not change based on the context in which they are used. Even in the case of heteronyms, it’s good to define the pronunciation you deem the most commonly used in your PLS file, as it may be the only case in your ebook(s). It also ensures that you know how the heteronym will always be pronounced by default, to remove the element of chance.
But let’s take a look at a minimal example of a complete PLS file to see how they work in practice. Here we’ll define a single entry for “acetaminophen” to cure our pronunciation headaches:
<lexicon
version="1.0"
alphabet="x-sampa"
xml:lang="en"
xmlns="http://www.w3.org/2005/01/pronunciation-lexicon">
<lexeme>
<grapheme>acetaminophen</grapheme>
<phoneme>@"sit@'mIn@f@n</phoneme>
</lexeme>
</lexicon>
To start breaking this markup down, the alphabet
attribute on the root lexicon element defines the
phonetic alphabet we’re going to use to write our pronunciations. In this case,
I’m indicating that I’m going to write them using X-SAMPA.