Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release > by-pkgid > f1f429f1e7336a64acc418038325ad85 > files > 21

flite-1.4-7.mga5.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created on October 18, 2014 by texi2html 5.0
texi2html was written by: 
            Lionel Cons <Lionel.Cons@cern.ch> (original author)
            Karl Berry  <karl@freefriends.org>
            Olaf Bachmann <obachman@mathematik.uni-kl.de>
            and many others.
Maintained by: Many creative people.
Send bugs and suggestions to <texi2html-bug@nongnu.org>
-->
<head>
<title>Flite: a small, fast speech synthesis engine: 8 Converting FestVox Voices</title>

<meta name="description" content="Flite: a small, fast speech synthesis engine: 8 Converting FestVox Voices">
<meta name="keywords" content="Flite: a small, fast speech synthesis engine: 8 Converting FestVox Voices">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2html 5.0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<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.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
pre.display {font-family: serif}
pre.format {font-family: serif}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: serif; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: serif; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:pre}
span.nolinebreak {white-space:pre}
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="Converting-FestVox-Voices"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="flite_6.html#APIs" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="flite_6.html#Streaming-Synthesis" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[ Up ]</td>
<td valign="middle" align="left">[<a href="#Cocantenative-Voice-Building" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="flite_8.html#Porting-to-new-platforms" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="flite.html#Abstract" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="flite_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[Index]</td>
<td valign="middle" align="left">[<a href="flite_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Converting-FestVox-Voices-1"></a>
<h1 class="chapter">8 Converting FestVox Voices</h1>

<p>As of 1.2 initial scripts have been added to aid the conversion of
FestVox voices to Flite.  In general the conversion cannot be automatic.
For example all specific Scheme code written for a voice needs to be
hand converted to C to work in Flite, this can be a major task.
</p>
<p>Simple conversion scripts are given as examples of the stages you need
to go through.  These are designed to work on standard (English)
diphone sets, and simple limited domain voices.  The conversion
technique will almost certainly fail for large unit selection voices
due to limitations in the C compiler (more discussion below).  In 1.4
we have also added support for converting clustergen voices too (which
is a little easier, see section below).
</p>
<hr>
<a name="Cocantenative-Voice-Building"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Converting-FestVox-Voices" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Converting-FestVox-Voices" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Converting-FestVox-Voices" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Statistical-Voice-Building" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="flite_8.html#Porting-to-new-platforms" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="flite.html#Abstract" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="flite_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[Index]</td>
<td valign="middle" align="left">[<a href="flite_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section">8.1 Cocantenative Voice Building</h2>

<p>Conversion is basically taking the description of units (clunit
catalogue or diphone index) and constructing some C files that can be
compiled to form a usable database.  Using the C compiler to generate
the object files has the advantage that we do not need to worry about
byte order, alignment and object formats as the C compiler for the
particular target platform should be able to generate the right code.
</p>
<p>Before you start ensure you have successfully built and run your FestVox
voice in Festival.  Flite is not designed as a voice building/debugging
tool it is just a delivery vehicle for finalized voices so you should
first ensure you are satisfied with the quality of Festival voices
before you start converting it for Flite.
</p>
<p>The following basic stages are required:
</p><ul>
<li> Setup the directories and copy the conversion scripts
</li><li> Build the LPC files
</li><li> Build the MCEP files (for ldom/clunits)
</li><li> Convert LPC (MCEP) into STS (short term signal) files
</li><li> Convert the catalogue/diphone index
</li><li> Compile the generated C code
</li></ul>

<p>The conversion assumes the environment variable <code>FLITEDIR</code>
is set, for example
</p><div class="example">
<pre class="example">   export FLITEDIR=/home/awb/projects/flite/
</pre></div>
<p>The basic flite conversion takes place within a FestVox voice directory.
Thus all of the conversion scripts expect that the standard files are
available.  The first task is to build some new directories and copy in
the build scripts.  The scripts are copied rather than linked from the
Flite directories as you may need to change these for your particular
voices.
</p><div class="example">
<pre class="example">   $FLITEDIR/tools/setup_flite
</pre></div>
<p>This will read &lsquo;<tt>etc/voice.defs</tt>&rsquo;, which should have been created by
the FestVox build process (except in very old versions of FestVox).
</p>
<p>If you don&rsquo;t have a &lsquo;<tt>etc/voice.defs</tt>&rsquo; you can construct one
with <code>festvox/src/general/guess_voice_defs</code> in the Festvox
distribution, or generate one by hand making it look
like
</p><div class="example">
<pre class="example">FV_INST=cmu
FV_LANG=us
FV_NAME=ked_timit
FV_TYPE=clunits
FV_VOICENAME=$FV_INST&quot;_&quot;$FV_LANG&quot;_&quot;$FV_NAME
FV_FULLVOICENAME=$FV_VOICENAME&quot;_&quot;$FV_TYPE
</pre></div>

<p>The main script build building the Flite voice is &lsquo;<tt>bin/build_flite</tt>&rsquo;
which will eventually build sufficient C code in &lsquo;<tt>flite/</tt>&rsquo; that can
be compiled with the constructed &lsquo;<tt>flite/Makefile</tt>&rsquo; to give you a
library that can be linked into applications and also an example
&lsquo;<tt>flite</tt>&rsquo; binary with the constructed voice built-in.
</p>
<p>You can run all of these stages, except the final make, together by
running the the build script with no arguments
</p><div class="example">
<pre class="example">   ./bin/build_flite
</pre></div>
<p>But as things may not run smoothly, we will go through the 
stages explicitly.
</p>
<p>The first stage is to build the LPC files, this may have already been
done as part of the diphone building process (though probably not in
the ldom/clunit case).  In our experience it is very important that the
records be of similar power, as mis-matched power can often cause
overflows in the resulting flite (and sometimes Festival) voices. Thus,
for diphone voices, it is important to run the power normalization
techniques described int he FestVox document.  The Flite LPC build
process also builds a parameter file of the ranges of the LPC parameters
used in later coding of the files, so even if you have already built your
LPC files you should still do this again
</p><div class="example">
<pre class="example">   ./bin/build_flite lpc
</pre></div>

<p>For ldom, and clunit voices (but not for diphone voices) we also
need the Mel-frequency Cepstral Coefficients.  These are assumed to
have been cleared and are in &lsquo;<tt>mcep/</tt>&rsquo; as they are necessary
for running the voice in Festival.  This stage simply constructs 
information about the range of the mcep parameters.
</p><div class="example">
<pre class="example">   ./bin/build_flite mcep
</pre></div>

<p>The next stage is to construct the STS files.  Short Term Signals (STS)
are built for each pitch period in the database.  These are ascii files
(one for each utterance file in the database, with LPC coefficients, and
ulaw encoded residuals for each pitch period.  These are built using a
binary executable built as part of the Flite build
(&lsquo;<tt>flite/tools/find_sts</tt>&rsquo;.
</p><div class="example">
<pre class="example">   ./bin/build_flite sts
</pre></div>
<p>Note that the flite code expects waveform files to be in Microsoft RIFF
format and cannot deal with files in other formats.  Some earlier
versions of the Edinburgh Speech Tools used NIST as the default header
format.  This is likely to cause flite and its related programs not
work. So do ensure you waveform files are in riff format (ch_wave -info
wav/* will tell you the format).  And the following fill convert
all you wave files
</p><div class="example">
<pre class="example">   mv wav wav.nist
   mkdir wav
   cd wav.nist
   for i in *.wav
   do
      ch_wave -otype riff -o ../wav/$i $i
   done
</pre></div>

<p>The next stage is to convert the index to the required C format.  For
diphone voices this takes the &lsquo;<tt>dic/*.est</tt>&rsquo; index files, for
clunit/ldom voices it takes the &lsquo;<tt>festival/clunit/VOICE.catalogue</tt>&rsquo;
and &lsquo;<tt>festival/trees/VOICE.tree</tt>&rsquo; files.  This process uses a binary
executable built as part of the Flite build process
(&lsquo;<tt>flite/tools/flite_sort</tt>&rsquo;) to sort the indices into the same
sorting order required for flite to run.  (Using unix sort may or may
not give the same result due to definitions of lexicographic order so
we use the very same function in C that will be used in flite to ensure
that a consistent order is given.)
</p><div class="example">
<pre class="example">   ./bin/build_flite idx
</pre></div>
<p>All the necessary C files should now have been built in &lsquo;<tt>flite/</tt>&rsquo;
and you may compile them by
</p><div class="example">
<pre class="example">   cd flite
   make
</pre></div>
<p>This should give a library and an executable called &lsquo;<tt>flite</tt>&rsquo; that
can run as
</p><div class="example">
<pre class="example">   ./flite &quot;Hello World&quot;
</pre></div>
<p>Assuming a general voice.  For ldom voices it will only be able to say
things in its domain.  This &lsquo;<tt>flite</tt>&rsquo; binary offers the same options
as standard the standard &lsquo;<tt>flite</tt>&rsquo; binary compiled in the Flite build
but with your voice rather than the distributed voices.
</p>
<p>Almost certainly this process will not run smoothly for you.  Building
voices is still a very hard thing to do and problems will probably
exist.
</p>
<p>This build process does not deal with customization for the given
voices.  Thus you will need to edit &lsquo;<tt>flite/VOICE.c</tt>&rsquo; to set
intonation ranges and duration stretch for your particular voice.
</p>
<p>For example in our &lsquo;<tt>cmu_us_sls_diphone</tt>&rsquo; voice (a US English female
diphone voice).  We had to change the default parameters from 
</p><div class="example">
<pre class="example">    feat_set_float(v-&gt;features,&quot;int_f0_target_mean&quot;,110.0);
    feat_set_float(v-&gt;features,&quot;int_f0_target_stddev&quot;,15.0);

    feat_set_float(v-&gt;features,&quot;duration_stretch&quot;,1.0); 
</pre></div>
<p>to
</p><div class="example">
<pre class="example">    feat_set_float(v-&gt;features,&quot;int_f0_target_mean&quot;,167.0);
    feat_set_float(v-&gt;features,&quot;int_f0_target_stddev&quot;,25.0);

    feat_set_float(v-&gt;features,&quot;duration_stretch&quot;,1.0); 
</pre></div>

<p>Note this conversion is limited.  Because it depends on the C compiler
to do the final conversion into binary object format (a good idea in
general for portability), you can easily generate files too big for the
C compiler to deal with.  We have spent a some time investigating this
so the largest possible voices can be converted but it is still too
limited for our larger voices.  In general the limitation seems to be
best quantified by the number of pitch periods in the database.  After
about 100k pitch periods the files get too big to handle.  There are
probably solutions to this but we have not yet investigated them.  This
limitation doesn&rsquo;t seem to be an issue with the diphone voices as they
are typically much smaller than unit selection voices.
</p>
<hr>
<a name="Statistical-Voice-Building"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Converting-FestVox-Voices" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Cocantenative-Voice-Building" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Converting-FestVox-Voices" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Lexicon-Conversion" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="flite_8.html#Porting-to-new-platforms" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="flite.html#Abstract" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="flite_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[Index]</td>
<td valign="middle" align="left">[<a href="flite_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section">8.2 Statistical Voice Building</h2>

<p>The process of building from a clustergen (cg) voice is also
supported.  It is assumed the environment variable <code>FLITEDIR</code> is
set
</p><div class="example">
<pre class="example">   export FLITEDIR=/home/awb/projects/flite/
</pre></div>
<p>After you build the clustergen voice you can convert by first setting
up the skeleton files in the &lsquo;<tt>flite/</tt>&rsquo; directory
</p><div class="example">
<pre class="example">   $FLITEDIR/tools/setup_flite
</pre></div>
<p>Assuming &lsquo;<tt>etc/voice.defs</tt>&rsquo; properly identifies the voice the cg
templates will be compied in.
</p>
<p>The conversion itself is actually much faster than a clunit build
(there is less to actually convert).
</p><div class="example">
<pre class="example">   ./bin/build_flite cg
</pre></div>
<p>Will convert then necessary models into files in the &lsquo;<tt>flite/</tt>&rsquo;
directory.  The you can compile it with
</p><div class="example">
<pre class="example">   cd flite
   make
   ./flite_cmu_us_awb &quot;Hello world&quot;
</pre></div>
<p>Note that the voice that is to be converted *must* be a standard
clustergen voice with f0, mceps, delta mceps and voicing in its
combined coeffs files.  The method could be changed to deal with other
possibilities but it will only work for default build method.
</p>
<p>The generated library &lsquo;<tt>libflite_cmu_us_awb.a</tt>&rsquo; may be linked with
other programs linkle any other flite voice.  The binary generated
<code>flite_cmu_us_awb</code> links in only one voice (unlike the flite binary in
the full flite distribution.
</p>
<hr>
<a name="Lexicon-Conversion"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Converting-FestVox-Voices" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Statistical-Voice-Building" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Converting-FestVox-Voices" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Language-Conversion" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="flite_8.html#Porting-to-new-platforms" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="flite.html#Abstract" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="flite_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[Index]</td>
<td valign="middle" align="left">[<a href="flite_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section">8.3 Lexicon Conversion</h2>

<p>As of 1.3 the script for converting the CMU lexicon (as distributed as
part of Festival) is included.  &lsquo;<tt>make_cmulex</tt>&rsquo; will using the
version of CMULEX unpacked in the current directory to build a new
lexicon.  Also in 1.3. a more sophisticated compression technique is
used to reduce the lexicon size.  The lexicon is pruned, removing
those words which the letter to sound rule models get correct.  Also
the letters and phones are separately huffman coded to produce a
smaller lexicon.
</p>
<hr>
<a name="Language-Conversion"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Converting-FestVox-Voices" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Lexicon-Conversion" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="#Converting-FestVox-Voices" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="flite_8.html#Porting-to-new-platforms" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left">[<a href="flite_8.html#Porting-to-new-platforms" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="flite.html#Abstract" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="flite_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[Index]</td>
<td valign="middle" align="left">[<a href="flite_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section">8.4 Language Conversion</h2>

<p>This is by far the weakest part as this is the most open ended.  There
are basic tools in the &lsquo;<tt>flite/tools/</tt>&rsquo; directory that include Scheme
code to convert various Scheme structures to C include CART tree
conversion and Lisp list conversion.  The other major source of help
here is the existing language examples in &lsquo;<tt>flite/lang/usenglish/</tt>&rsquo;.
</p>
<hr>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Converting-FestVox-Voices" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="flite_8.html#Porting-to-new-platforms" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="flite.html#Abstract" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="flite_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[Index]</td>
<td valign="middle" align="left">[<a href="flite_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p>
 <font size="-1">
  This document was generated on <i>October 18, 2014</i> using <a href="http://www.nongnu.org/texi2html/"><i>texi2html 5.0</i></a>.
 </font>
 <br>

</p>
</body>
</html>