/usr/share/doc/festival-doc/html/Building-a-new-voice.html is in festival-doc 1:2.4~release-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Festival Speech Synthesis System: Building a new voice</title>
<meta name="description" content="Festival Speech Synthesis System: Building a new voice">
<meta name="keywords" content="Festival Speech Synthesis System: Building a new voice">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Index.html#Index" rel="index" title="Index">
<link href="Index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Voices.html#Voices" rel="up" title="Voices">
<link href="Defining-a-new-voice.html#Defining-a-new-voice" rel="next" title="Defining a new voice">
<link href="Current-voices.html#Current-voices" rel="prev" title="Current voices">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Building-a-new-voice"></a>
<div class="header">
<p>
Next: <a href="Defining-a-new-voice.html#Defining-a-new-voice" accesskey="n" rel="next">Defining a new voice</a>, Previous: <a href="Current-voices.html#Current-voices" accesskey="p" rel="prev">Current voices</a>, Up: <a href="Voices.html#Voices" accesskey="u" rel="up">Voices</a> [<a href="Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Building-a-new-voice-1"></a>
<h3 class="section">24.2 Building a new voice</h3>
<a name="index-spanish-voice"></a>
<p>This section runs through the definition of a new voice in Festival.
Although this voice is simple (it is a simplified version of the
distributed spanish voice) it shows all the major parts that must be
defined to get Festival to speak in a new voice. Thanks go to Alistair
Conkie for helping me define this but as I don’t speak Spanish there are
probably many mistakes. Hopefully its pedagogical use is better than
its ability to be understood in Castille.
</p>
<p>A much more detailed document on building voices in Festival has been
written and is recommend reading for any one attempting to add a new
voice to Festival <cite>black99</cite>. The information here is a little
sparse though gives the basic requirements.
</p>
<p>The general method for defining a new voice is to define the
parameters for all the various sub-parts e.g. phoneset, duration
parameter intonation parameters etc., then defined a function
of the form <code>voice_NAME</code> which when called will actually
select the voice.
</p>
<a name="Phoneset"></a>
<h4 class="subsection">24.2.1 Phoneset</h4>
<a name="index-phoneset-definitions"></a>
<p>For most new languages and often for new dialects, a new
phoneset is required. It is really the basic building
block of a voice and most other parts are defined in terms
of this set, so defining it first is a good start.
</p><div class="example">
<pre class="example">(defPhoneSet
spanish
;;; Phone Features
(;; vowel or consonant
(vc + -)
;; vowel length: short long diphthong schwa
(vlng s l d a 0)
;; vowel height: high mid low
(vheight 1 2 3 -)
;; vowel frontness: front mid back
(vfront 1 2 3 -)
;; lip rounding
(vrnd + -)
;; consonant type: stop fricative affricative nasal liquid
(ctype s f a n l 0)
;; place of articulation: labial alveolar palatal labio-dental
;; dental velar
(cplace l a p b d v 0)
;; consonant voicing
(cvox + -)
)
;; Phone set members (features are not! set properly)
(
(# - 0 - - - 0 0 -)
(a + l 3 1 - 0 0 -)
(e + l 2 1 - 0 0 -)
(i + l 1 1 - 0 0 -)
(o + l 3 3 - 0 0 -)
(u + l 1 3 + 0 0 -)
(b - 0 - - + s l +)
(ch - 0 - - + a a -)
(d - 0 - - + s a +)
(f - 0 - - + f b -)
(g - 0 - - + s p +)
(j - 0 - - + l a +)
(k - 0 - - + s p -)
(l - 0 - - + l d +)
(ll - 0 - - + l d +)
(m - 0 - - + n l +)
(n - 0 - - + n d +)
(ny - 0 - - + n v +)
(p - 0 - - + s l -)
(r - 0 - - + l p +)
(rr - 0 - - + l p +)
(s - 0 - - + f a +)
(t - 0 - - + s t +)
(th - 0 - - + f d +)
(x - 0 - - + a a -)
)
)
(PhoneSet.silences '(#))
</pre></div>
<a name="index-silences-1"></a>
<p>Note some phonetic features may be wrong.
</p>
<a name="Lexicon-and-LTS"></a>
<h4 class="subsection">24.2.2 Lexicon and LTS</h4>
<p>Spanish is a language whose pronunciation can almost completely be
predicted from its orthography so in this case we do not need a
list of words and their pronunciations and can do most of the work
with letter to sound rules.
</p>
<a name="index-lexicon-creation"></a>
<p>Let us first make a lexicon structure as follows
</p><div class="example">
<pre class="example">(lex.create "spanish")
(lex.set.phoneset "spanish")
</pre></div>
<p>However if we did just want a few entries to test our system without
building any letter to sound rules we could add entries directly to
the addenda. For example
</p><div class="example">
<pre class="example">(lex.add.entry
'("amigos" nil (((a) 0) ((m i) 1) (g o s))))
</pre></div>
<p>A letter to sound rule system for Spanish is quite simple
in the format supported by Festival. The following is a good
start to a full set.
<a name="index-letter-to-sound-rules-3"></a>
</p><div class="example">
<pre class="example">(lts.ruleset
; Name of rule set
spanish
; Sets used in the rules
(
(LNS l n s )
(AEOU a e o u )
(AEO a e o )
(EI e i )
(BDGLMN b d g l m n )
)
; Rules
(
( [ a ] = a )
( [ e ] = e )
( [ i ] = i )
( [ o ] = o )
( [ u ] = u )
( [ "'" a ] = a1 ) ;; stressed vowels
( [ "'" e ] = e1 )
( [ "'" i ] = i1 )
( [ "'" o ] = o1 )
( [ "'" u ] = u1 )
( [ b ] = b )
( [ v ] = b )
( [ c ] "'" EI = th )
( [ c ] EI = th )
( [ c h ] = ch )
( [ c ] = k )
( [ d ] = d )
( [ f ] = f )
( [ g ] "'" EI = x )
( [ g ] EI = x )
( [ g u ] "'" EI = g )
( [ g u ] EI = g )
( [ g ] = g )
( [ h u e ] = u e )
( [ h i e ] = i e )
( [ h ] = )
( [ j ] = x )
( [ k ] = k )
( [ l l ] # = l )
( [ l l ] = ll )
( [ l ] = l )
( [ m ] = m )
( [ ~ n ] = ny )
( [ n ] = n )
( [ p ] = p )
( [ q u ] = k )
( [ r r ] = rr )
( # [ r ] = rr )
( LNS [ r ] = rr )
( [ r ] = r )
( [ s ] BDGLMN = th )
( [ s ] = s )
( # [ s ] C = e s )
( [ t ] = t )
( [ w ] = u )
( [ x ] = k s )
( AEO [ y ] = i )
( # [ y ] # = i )
( [ y ] = ll )
( [ z ] = th )
))
</pre></div>
<p>We could simply set our lexicon to use the above letter to sound
system with the following command
</p><div class="example">
<pre class="example">(lex.set.lts.ruleset 'spanish)
</pre></div>
<p>But this would not deal with upper case letters. Instead of
writing new rules for upper case letters we can define that
a Lisp function be called when looking up a word and intercept
the lookup with our own function. First we state that unknown
words should
call a function, and then define the function we wish called.
The actual link to ensure our function will be called is done
below at lexicon selection time
</p><div class="example">
<pre class="example">(define (spanish_lts word features)
"(spanish_lts WORD FEATURES)
Using letter to sound rules build a spanish pronunciation of WORD."
(list word
nil
(lex.syllabify.phstress (lts.apply (downcase word) 'spanish))))
(lex.set.lts.method spanish_lts)
</pre></div>
<p>In the function we downcase the word and apply the LTS rule to it.
Next we syllabify it and return the created lexical entry.
</p>
<a name="Phrasing"></a>
<h4 class="subsection">24.2.3 Phrasing</h4>
<p>Without detailed labelled databases we cannot build statistical models
of phrase breaks, but we can simply build a phrase break model based
on punctuation. The following is a CART tree to predict simple breaks,
from punctuation.
</p><div class="example">
<pre class="example">(set! spanish_phrase_cart_tree
'
((lisp_token_end_punc in ("?" "." ":"))
((BB))
((lisp_token_end_punc in ("'" "\"" "," ";"))
((B))
((n.name is 0) ;; end of utterance
((BB))
((NB))))))
</pre></div>
<a name="Intonation-2"></a>
<h4 class="subsection">24.2.4 Intonation</h4>
<p>For intonation there are number of simple options without requiring
training data. For this example we will simply use a hat pattern on all
stressed syllables in content words and on single syllable content
words. (i.e. <code>Simple</code>) Thus we need an accent prediction CART
tree.
</p><div class="example">
<pre class="example">(set! spanish_accent_cart_tree
'
((R:SylStructure.parent.gpos is content)
((stress is 1)
((Accented))
((position_type is single)
((Accented))
((NONE))))
((NONE))))
</pre></div>
<p>We also need to specify the pitch range of our speaker. We will
be using a male Spanish diphone database of the follow range
</p><div class="example">
<pre class="example">(set! spanish_el_int_simple_params
'((f0_mean 120) (f0_std 30)))
</pre></div>
<a name="Duration-2"></a>
<h4 class="subsection">24.2.5 Duration</h4>
<p>We will use the trick mentioned above for duration prediction.
Using the zscore CART tree method, we will actually use it to
predict factors rather than zscores.
</p>
<p>The tree predicts longer durations in stressed syllables and in
clause initial and clause final syllables.
</p><div class="example">
<pre class="example">(set! spanish_dur_tree
'
((R:SylStructure.parent.R:Syllable.p.syl_break > 1 ) ;; clause initial
((R:SylStructure.parent.stress is 1)
((1.5))
((1.2)))
((R:SylStructure.parent.syl_break > 1) ;; clause final
((R:SylStructure.parent.stress is 1)
((2.0))
((1.5)))
((R:SylStructure.parent.stress is 1)
((1.2))
((1.0))))))
</pre></div>
<p>In addition to the tree we need durations for each phone in the
set
</p><div class="example">
<pre class="example">(set! spanish_el_phone_data
'(
(# 0.0 0.250)
(a 0.0 0.090)
(e 0.0 0.090)
(i 0.0 0.080)
(o 0.0 0.090)
(u 0.0 0.080)
(b 0.0 0.065)
(ch 0.0 0.135)
(d 0.0 0.060)
(f 0.0 0.100)
(g 0.0 0.080)
(j 0.0 0.100)
(k 0.0 0.100)
(l 0.0 0.080)
(ll 0.0 0.105)
(m 0.0 0.070)
(n 0.0 0.080)
(ny 0.0 0.110)
(p 0.0 0.100)
(r 0.0 0.030)
(rr 0.0 0.080)
(s 0.0 0.110)
(t 0.0 0.085)
(th 0.0 0.100)
(x 0.0 0.130)
))
</pre></div>
<a name="Waveform-synthesis"></a>
<h4 class="subsection">24.2.6 Waveform synthesis</h4>
<p>There are a number of choices for waveform synthesis currently
supported. MBROLA supports Spanish, so we could use that. But their
Spanish diphones in fact use a slightly different phoneset so we would
need to change the above definitions to use it effectively. Here we will
use a diphone database for Spanish recorded by Eduardo Lopez when he was
a Masters student some years ago.
</p>
<p>Here we simply load our pre-built diphone database
</p><div class="example">
<pre class="example">(us_diphone_init
(list
'(name "el_lpc_group")
(list 'index_file
(path-append spanish_el_dir "group/ellpc11k.group"))
'(grouped "true")
'(default_diphone "#-#")))
</pre></div>
<a name="Voice-selection-function"></a>
<h4 class="subsection">24.2.7 Voice selection function</h4>
<p>The standard way to define a voice in Festival is to define
a function of the form <code>voice_NAME</code> which selects
all the appropriate parameters. Because the definition
below follows the above definitions we know that everything
appropriate has been loaded into Festival and hence we
just need to select the appropriate a parameters.
</p>
<div class="example">
<pre class="example">(define (voice_spanish_el)
"(voice_spanish_el)
Set up synthesis for Male Spanish speaker: Eduardo Lopez"
(voice_reset)
(Parameter.set 'Language 'spanish)
;; Phone set
(Parameter.set 'PhoneSet 'spanish)
(PhoneSet.select 'spanish)
(set! pos_lex_name nil)
;; Phrase break prediction by punctuation
(set! pos_supported nil)
;; Phrasing
(set! phrase_cart_tree spanish_phrase_cart_tree)
(Parameter.set 'Phrase_Method 'cart_tree)
;; Lexicon selection
(lex.select "spanish")
;; Accent prediction
(set! int_accent_cart_tree spanish_accent_cart_tree)
(set! int_simple_params spanish_el_int_simple_params)
(Parameter.set 'Int_Method 'Simple)
;; Duration prediction
(set! duration_cart_tree spanish_dur_tree)
(set! duration_ph_info spanish_el_phone_data)
(Parameter.set 'Duration_Method 'Tree_ZScores)
;; Waveform synthesizer: diphones
(Parameter.set 'Synth_Method 'UniSyn)
(Parameter.set 'us_sigpr 'lpc)
(us_db_select 'el_lpc_group)
(set! current-voice 'spanish_el)
)
(provide 'spanish_el)
</pre></div>
<a name="Last-remarks"></a>
<h4 class="subsection">24.2.8 Last remarks</h4>
<p>We save the above definitions in a file <samp>spanish_el.scm</samp>. Now we
can declare the new voice to Festival. See <a href="Defining-a-new-voice.html#Defining-a-new-voice">Defining a new voice</a>,
for a description of methods for adding new voices. For testing
purposes we can explciitly load the file <samp>spanish_el.scm</samp>
</p>
<p>The voice is now available for use in festival.
</p><div class="example">
<pre class="example">festival> (voice_spanish_el)
spanish_el
festival> (SayText "hola amigos")
<Utterance 0x04666>
</pre></div>
<p>As you can see adding a new voice is not very difficult. Of course
there is quite a lot more than the above to add a high quality robust
voice to Festival. But as we can see many of the basic tools that we
wish to use already exist. The main difference between the above voice
and the English voices already in Festival are that their models are
better trained from databases. This produces, in general, better
results, but the concepts behind them are basically the same. All
of those trainable methods may be parameterized with data for
new voices.
</p>
<p>As Festival develops, more modules will be added with better support for
training new voices so in the end we hope that adding in high quality
new voices is actually as simple as (or indeed simpler than) the above
description.
</p>
<a name="Resetting-globals"></a>
<h4 class="subsection">24.2.9 Resetting globals</h4>
<a name="index-reseting-globals"></a>
<a name="index-voice_005freset"></a>
<p>Because the version of Scheme used in Festival only has a single flat
name space it is unfortunately too easy for voices to set some global
which accidentally affects all other voices selected after it. Because
of this problem we have introduced a convention to try to minimise the
possibility of this becoming a problem. Each voice function
defined should always call <code>voice_reset</code> at the start. This
will reset any globals and also call a tidy up function provided by
the previous voice function.
</p>
<p>Likewise in your new voice function you should provide a tidy up
function to reset any non-standard global variables you set. The
function <code>current_voice_reset</code> will be called by
<code>voice_reset</code>. If the value of <code>current_voice_reset</code> is
<code>nil</code> then it is not called. <code>voice_reset</code> sets
<code>current_voice_reset</code> to <code>nil</code>, after calling it.
</p>
<p>For example suppose some new voice requires the audio device to
be directed to a different machine. In this example we make
the giant’s voice go through the netaudio machine <code>big_speakers</code>
while the standard voice go through <code>small_speakers</code>.
</p>
<p>Although we can easily select the machine <code>big_speakers</code> as out
when our <code>voice_giant</code> is called, we also need to set it back when
the next voice is selected, and don’t want to have to modify every other
voice defined in the system. Let us first define two functions to
selection the audio output.
</p><div class="lisp">
<pre class="lisp">(define (select_big)
(set! giant_previous_audio (getenv "AUDIOSERVER"))
(setenv "AUDIOSERVER" "big_speakers"))
(define (select_normal)
(setenv "AUDIOSERVER" giant_previous_audio))
</pre></div>
<p>Note we save the previous value of <code>AUDIOSERVER</code> rather than simply
assuming it was <code>small_speakers</code>.
</p>
<p>Our definition of <code>voice_giant</code> definition of <code>voice_giant</code>
will look something like
</p><div class="lisp">
<pre class="lisp">(define (voice_giant)
"comment comment ..."
(voice_reset) ;; get into a known state
(select_big)
;;; other giant voice parameters
...
(set! current_voice_rest select_normal)
(set! current-voice 'giant))
</pre></div>
<p>The obvious question is which variables should a voice reset.
Unfortunately there is not a definitive answer to that. To a certain
extent I don’t want to define that list as there will be many variables
that will by various people in Festival which are not in the original
distribution and we don’t want to restrict them. The longer term answer
is some for of partitioning of the Scheme name space perhaps having
voice local variables (cf. Emacs buffer local variables). But
ultimately a voice may set global variables which could redefine the
operation of later selected voices and there seems no real way to stop
that, and keep the generality of the system.
</p>
<a name="index-current-voice"></a>
<p>Note the convention of setting the global <code>current-voice</code> as
the end of any voice definition file. We do not enforce this
but probabaly should. The variable <code>current-voice</code> at
any time should identify the current voice, the voice
description information (described below) will relate this name
to properties identifying it.
</p>
<hr>
<div class="header">
<p>
Next: <a href="Defining-a-new-voice.html#Defining-a-new-voice" accesskey="n" rel="next">Defining a new voice</a>, Previous: <a href="Current-voices.html#Current-voices" accesskey="p" rel="prev">Current voices</a>, Up: <a href="Voices.html#Voices" accesskey="u" rel="up">Voices</a> [<a href="Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|