<!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: 4 Installation</title> <meta name="description" content="Flite: a small, fast speech synthesis engine: 4 Installation"> <meta name="keywords" content="Flite: a small, fast speech synthesis engine: 4 Installation"> <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="Installation"></a> <table class="header" cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="flite_2.html#Acknowledgements" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="flite_2.html#Acknowledgements" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[ Up ]</td> <td valign="middle" align="left">[<a href="#Windows-Support" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left">[<a href="flite_4.html#Flite-Design" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </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="Installation-1"></a> <h1 class="chapter">4 Installation</h1> <p>Flite consist simple of a set of C files. GNU configure is used to configure the engine and will work on most major architectures. </p> <p>In general, the following should build the system </p><div class="example"> <pre class="example">tar zxvf flite-XXX.tar.gz cd flite-XXX ./configure make </pre></div> <p>However you will need to explicitly call GNU make <code>gmake</code> if <code>make</code> is not GNU make on your system. </p> <p>The configuration process build a file ‘<tt>config/config</tt>’ which under some circumstances may need to be edited, e.g. to add unusual options or dealing with cross compilation. </p> <p>On Linux systems, we also support shared libraries which are useful for keeping space down when multiple different application are linked to the flite libraries. For development we strong discourage use of shared libraries as it is too easy to either not set them up correctly or accidentally pick up the wrong version. But for installation they are definitely encouraged. That is if you are just going to make and install they are good but unless you know what <var>LD_LIBRARY_PATH</var> does, it may be better to use static libraries (the default) if you are changing C code or building your own voices. </p><div class="example"> <pre class="example">./configure --enable-shared make </pre></div> <p>This will build both shared and static versions of the libraries but will link the executables to the <em>shared</em> libraries thus you will need to install the libraries in a place that your dynamic linker will find them (cf. /etc/ld.so.conf) or set <var>LD_LIBRARY_PATH</var> appropriately. </p> <div class="example"> <pre class="example">make install </pre></div> <p>Will installe the binaries (‘<tt>bin/flite*</tt>’), include files and libraries in appropriate subdirectories of the defined install directory, ‘<tt>/usr/local</tt>’ by default. You can change this at configure time with </p><div class="example"> <pre class="example">./configure --prefix=/opt </pre></div> <hr> <a name="Windows-Support"></a> <table class="header" cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Installation" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Installation" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#Installation" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Window-CE-Support" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left">[<a href="flite_4.html#Flite-Design" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </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">4.1 Windows Support</h2> <hr> <a name="Window-CE-Support"></a> <table class="header" cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Installation" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Windows-Support" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#Installation" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#PalmOS-Support" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left">[<a href="flite_4.html#Flite-Design" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </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">4.2 Window CE Support</h2> <p>Flite has been successfully compiled by a number of different groups under Windows CE. The system should compile under Embedded Visual Studio but we not have the full details. </p> <p>The system as distributed does compile under the gcc ‘<tt>mingw32ce</tt>’ toolchain available from <a href="http://cegcc.sourceforge.net/">http://cegcc.sourceforge.net/</a>. The current version can be compiled and run under WinCE with a primitive application called ‘<tt>flowm</tt>’. ‘<tt>flowm</tt>’ is a simple application that allows playing of typed-in text, or full text to speech on a file. Files should be a simple ascii text files <code>*.txt</code>. The application allows the setting of the byte position to start synthesis from. </p> <p>Assuming you have ‘<tt>mingw32ce</tt>’ installed you can configure as </p><div class="example"> <pre class="example">./configure --target=arm-wince make </pre></div> <p>The resulting binary is given in ‘<tt>wince/flowm.exe</tt>’. If you copy this onto your Windows Mobile device and run it, it should allow you to speak typed-in text and any ‘<tt>*.txt</tt>’ files you have on your device. </p> <p>The application uses <code>cmu_us_kal</code> as the voice for default. Although it is possible to include the clustergen voices, they may be too slow to be really practical. An 8KHz clustergen voice with a reduced order to 13 gives a voices that runs acceptably on an hp2755 (624MHz) but still marginal on an AT&T Tilt (400MHz). </p> <p>Building 8KHz clustergen voices is currently a bit of hack. We take the standard waveforms and resample them to 8KHz, then relabel the sample rate to be 16KHz. Then build the voice as normal (as if the speaker spoke twice as fast. You may need to have tune the F0 parameters in ‘<tt>etc/f0.params</tt>’. This seems to basically work. Then after the waveform is synthesized (still in the "chipmunk” domain) we then playit back at 8KHz. This effectively means we generate half the number of samples and the frames are really at 10ms. A second reduction is an option on the basic ‘<tt>build_flite</tt>’ command. A second argument can specify order reduction, thus instead of the standard 25 static parameters (plus its deltas) we can reduce this to 13 and still get acceptable results </p><div class="example"> <pre class="example">./bin/build_flite cg 13 cd flite make </pre></div> <p>Importantly this uses less space, and uses less time to synthesis. These <code>SPEECH_HACKS</code> in ‘<tt>src/cg/cst_mlsa.c</tt>’ are switched on by default when <code>UNDER_CE</code> is defined. </p> <p>The reduced order properly extracts the statics (and stddev) and deltas (and stddev) from the predicted parameter clusters and makes it as if those were the sizes of parameters that were used to the train the voice. </p> <hr> <a name="PalmOS-Support"></a> <table class="header" cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Installation" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Window-CE-Support" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#Installation" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Some-notes-on-the-PalmOS-port" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left">[<a href="flite_4.html#Flite-Design" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </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">4.3 PalmOS Support</h2> <p>Starting with 1.3 we have initial support for PalmOS using the free development tools. The compilation method assumes the target device is running PalmOS 5.0 (or later) on an ARM processor. Following convention in the Palm world, the app that the user interacts with is actually a m68k application compiled with the m68 gcc cross compiler, the resulting code is interpreted by the PalmOS 5.0 device. The core flite code is in native ARM, and hence uses the ARM gcc cross compiler. An interesting amout of support code is required to get all this work properly. </p> <p>The user app is called <code>flop</code> (FLite on Palm) and like most apps written by awb, is functional, but ugly. You should not let a short-sighted Scotsman, who still thinks command line interfaces are cool, design a graphical app. But it does work and can read typed-in text. The ‘<tt>armflite.ro</tt>’ resources are designed with the idea that proper applications will be written using it as a library. </p> <p>The ‘<tt>flop.prc</tt>’ application is distributed separately so it can be used without having to install all these tools. But if you want to PalmOS development here is what you need to do to compile Flite for PalmOS and the flop application. </p> <p>There are number of different application development environments for Palm, here I only describe the Unix based one as this is what was used. You will need the PalmOS SDK 5.0 from palmOne <a href="http://www.palmone.com/us/developers/">http://www.palmone.com/us/developers/</a>. This is free but does require registration. Out of the lots of different files you can get for palmOne you will eventually find ‘<tt>palmos-sdk-5.0r3-1.noarch.rpm</tt>’, install that on your linux machine </p><div class="example"> <pre class="example">rpm -i palmos-sdk-5.0r3-1.noarch.rpm </pre></div> <p>You will also need the various gcc based cross compilers <a href="http://prc-tools.sourceforge.net/">http://prc-tools.sourceforge.net/</a> </p><div class="example"> <pre class="example">prc-tools-2.3-1.i386.rpm prc-tools-arm-2.3-1.i386.rpm prc-tools-htmldocs-2.3-1.noarch.rpm </pre></div> <p>The Palm Resource compiler <a href="http://pilrc.sourceforge.net/">http://pilrc.sourceforge.net/</a> </p><div class="example"> <pre class="example">pilrc-3.1-1.i386.rpm </pre></div> <p>And maybe the emulator <a href="http://www.palmos.com/dev/tools/emulator/">http://www.palmos.com/dev/tools/emulator/</a> </p><div class="example"> <pre class="example">pose-3.5-2.i386.rpm pose-skins-1.9-1.noarch.rpm pose-skins-handspring-3.1H4-1.noarch.rpm </pre></div> <p>Though as POSE doesn’t support ARM code, ‘<tt>Simulator</tt>’ does but that only works under Windows, POSE is only useful for debugging the m68k parts of the app. </p> <p>Install these </p><div class="example"> <pre class="example">rpm -i prc-tools-2.3-1.i386.rpm rpm -i prc-tools-arm-2.3-1.i386.rpm rpm -i prc-tools-htmldocs-2.3-1.noarch.rpm rpm -i pilrc-3.1-1.i386.rpm rpm -i pose-3.5-2.i386.rpm rpm -i pose-skins-1.9-1.noarch.rpm rpm -i pose-skins-handspring-3.1H4-1.noarch.rpm </pre></div> <p>We also need the prc-tools to know which SDK is available </p><div class="example"> <pre class="example">palmdev-prep </pre></div> <p>In addition we use Greg Parker’s PEAL <a href="http://www.sealiesoftware.com/peal/">http://www.sealiesoftware.com/peal/</a> ELF ARM loader. You need to download this and compile and install it yourself, so that <code>peal-postlink</code> is in your path. Greg was very helpful and even added support for large data segments for this work (though in the end we don’t actually use them). Some peal code is in our distribution (which is valid under his licence) but if you use a different version of peal you may need to ensure they are matched, by updating the peal code in ‘<tt>palm/</tt>’. We used version ‘<tt>peal-2004-12-29</tt>’. </p> <p>The other palm specific function we require is <code>par</code> <a href="http://www.djw.org/product/palm/par/">http://www.djw.org/product/palm/par/</a> which is part of the <code>prc.tgz</code> distribution. We use <code>par</code> to construct resources from raw binary files. There are other programs that can do this but we found this one adequate. Again you must compile this and ensure <code>par</code> is in your path. Note no part of <code>par</code> ends up in the distributed system. </p> <p>Given all of the above you should be able to compile the Palm code and the <code>flop</code> application. </p><div class="example"> <pre class="example"> ./configure --target=arm-palmos make </pre></div> <p>The resulting application should be in ‘<tt>palm/flop/flop.prc</tt>’ which can then be installed on your Plam device </p><div class="example"> <pre class="example"> pilot-xfer -i palm/flop/flop.prc </pre></div> <p>Setting up the tools, and getting a working Linux/Palm conduit is not particularly easy but it is possible. Although some attempt was made to use the Simulator, (PalmOS 5.0/ARM simulator) under Windows, it never really contributed to the development. The POSE (m68k) emulator though was use to develop the <code>flop</code> application itself. </p> <hr> <a name="Some-notes-on-the-PalmOS-port"></a> <table class="header" cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Installation" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#PalmOS-Support" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#PalmOS-Support" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="#Using-the-PalmOS" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left">[<a href="flite_4.html#Flite-Design" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </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> <h3 class="subsection">4.3.1 Some notes on the PalmOS port</h3> <p>Throughout the PalmOS developer documentation they continually remind you that a Palm device is not a full computer, its an extention of the desktop. But seeing devices like the Treo 600 can easily make one forget and want the device to do real computational work. PalmOS is designed for small light weight devices so it is easy to start hitting the boundaries of its capabilities when trying to port larger aplications. </p> <p>PalmOS5.0 still has interesting limitations, in the m68k domain, <code>int</code>’s are 16 bit and using memory segments greater than 65K require special work. Quaint as these are, they do significantly affect the port. At first we thought that only the key computationally expensive parts would be in ARM (so-called <code>armlets</code>) but trying to compile the whole flite code in m68k with long/short distinctions and sub-64K code segment limitations was just too hard. </p> <p>Thus all the Flite code, USEnglish, Lexicon and diphone databases actually are compiled in the ARM domain. There is however no system support in the ARM domain so call backs to m68k system functions are necessary. With care calls to system functions can be significantly limited so only a few call backs needed to be written. These are in ‘<tt>palm/pocore/</tt>’. I believe CodeWarrior has better support for this, but in this case we rolled our own (though help from other open source examples was important). </p> <p>We manage the m68k/ARM interface through PEAL, which is basically a linker for ARM code and calling mechanism from m68k. PEAL deals with globals and spliting the code into 65K chunks automatically. </p> <p>Flite does however have a number of large data segments, in the lexicon and the voice database itself. PEAL can deal with this but it loads large segments by copying them into the dynamic heap, which on most Palm device is less than 2M. This isn’t big enough. </p> <p>Thus we changed Flite to restrict the number of large data sgements it used (and also did some new compression on them). The five segments: the lts rules, the lexical entries, the voice LPC coefficients, the voice residuals and the voice residual index are now treated a data segments that are split into 65400 sized segments and loaded into feature memory space, which is in the storage heap and typically much bigger. This means we do need about 2-3 megabyte free on the device to run. We did look into just indexing the 65400 byte segments directly but that looked like being too much work, and we’re only going to be able to run on 16M sized Palms anyway (there aren’t any 8M ARM Palms with audio, expect maybe some SmartPhones). </p> <p>Using Flite from m68k land involves getting a <code>flite_info</code> structure from <code>flite_init()</code>. This contains a bunch of fields that be set and sent to the ARM domain Flite synthesizer proper within which other output fields may be set and returned. This isn’t a very general structure, but is adequate. Note the necessary byte swapping (for the top level fileds) is done for the this structure, before calling the ARM native <code>arm_flite_synth_text</code> and swapped back again after returning. </p> <p>Display, playing audio, pointy-clicky event thingies are all done in the m68K domain. </p> <hr> <a name="Using-the-PalmOS"></a> <table class="header" cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Installation" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="#Some-notes-on-the-PalmOS-port" title="Previous section in reading order"> < </a>]</td> <td valign="middle" align="left">[<a href="#PalmOS-Support" title="Up section"> Up </a>]</td> <td valign="middle" align="left">[<a href="flite_4.html#Flite-Design" title="Next section in reading order"> > </a>]</td> <td valign="middle" align="left">[<a href="flite_4.html#Flite-Design" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </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> <h3 class="subsection">4.3.2 Using the PalmOS</h3> <p>There are three basic functions that access the ARM flite functions: <code>flite_init()</code>, <code>flite_synth_text()</code> and <code>flite_end()</code>. </p> <hr> <table class="header" cellpadding="1" cellspacing="1" border="0"> <tr><td valign="middle" align="left">[<a href="#Installation" title="Beginning of this chapter or previous chapter"> << </a>]</td> <td valign="middle" align="left">[<a href="flite_4.html#Flite-Design" title="Next chapter"> >> </a>]</td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </td> <td valign="middle" align="left"> </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>