Festival, SABLE, and a different kind of Echo Test

image by David Revoy
Asterisk’s text-to-speech system is called Festival. By itself, Festival sounds like a pretty run-of-the-mill text-to-speech system, but it does have the ability to understand SABLE, which is a markup language for rendering text as speech. (There’s a good tag reference for SABLE here.) The idea is that you feed your marked up text into Festival, which then can alter the pitch, speed, speaker, etcetera for your text as it “reads” it, supposedly making it sound more natural. At the very least, it can help you get pronunciations of proper names and unknown words correct.
While you can use Festival and SABLE with PHP to generate audio for something dynamic (say, an RSS feed), I was more interested in using SABLE to tune a static text. I’m brainstorming an Asterisk project based around the myth of Echo and Narcissus, so to get up to speed with SABLE, I used it to mark up Ovid’s telling of the story from Metamorphoses.
All the code is after the break.
Here’s the SABLE markup:
"Sable.v0_2.dtd"
[]>
Famed far and near for knowing things to come,
From him the enquiring nations sought their doom;
The fair
And first the unerring prophet justified.
This nymph the god
With all his winding waters circumfused,
And on the
Whom the soft maids ev’n then beheld with joy.
The tender dame,
Whether her child should reach old age
Consults the sage
Long lived the dubious mother in suspence,
Narcissus now his sixteenth year began,
Just turned of boy, and on the verge of man;
Such was his pride, in vain the friend caressed,
Once,
The babbling
She, who in others’ words her silence breaks,
Nor speaks her self but when another speaks.
Echo was then a maid,
Of wonted speech;
Juno a
To sport with every sentence in the close.
Full often when the Goddess might have caught
Jove and her rivals in the very fault,
This nymph with subtle stories would delay
Her coming, ’till the lovers sliped away.
The Goddess found out the deceit in time,
And then she cry’d,
Which could so many subtle tales produce,
Shall be hereafter but of little use.”
Hence ’tis she prattles in a fainter tone,
With mimick sounds, and accents not her own.
The boy alone, still followed him behind:
When glowing warmly at her near approach,
As sulphur blazes at the taper’s touch,
She longed her hidden passion to reveal,
And tell her pains, but had not words to tell:
To catch his voice, and to return the sound.
Still dashed with blushes for her slighted love,
Liv’d in the shady covert of the woods,
Where pining wandered the rejected fair,
‘Till harrassed out, and worn away with care,
Besides her bones and voice had nothing left.
Her bones are petrified, her voice is found
In vaults, where still it doubles every sound.
And here’s the system command to turn it into a wav file:
/usr/bin/text2wave -F 8000 -o /home/ajs292/asterisk_sounds/echo_sable.wav /home/ajs292/echo.sable
You can also put this in the System function in the dialplan, of course.
Activity