eSpeak NG is an open source speech synthesizer that supports more than hundred languages and accents.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

add_language.html 7.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <HTML>
  3. <HEAD>
  4. <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
  5. <TITLE>eSpeak: Adding a Language</TITLE>
  6. </HEAD>
  7. <BODY LANG="en-GB" DIR="LTR">
  8. <A href="docindex.html">Back</A>
  9. <HR>
  10. <H2>6. ADDING OR IMPROVING A LANGUAGE</H2>
  11. <HR>
  12. Most of the work doesn't need any programming knowledge. Just an understanding of the language, an
  13. awareness of its features, patience and attention to detail. Wikipedia is a good source of basic phonetic information, eg
  14. <a href="http://en.wikipedia.org/wiki/Vowel">http://en.wikipedia.org/wiki/Vowel</a>
  15. <P>
  16. In many cases it should be fairly easy to add a rough implementation of a new language, hopefully
  17. enough to be intelligible.<br>
  18. After that it's a gradual process of improvement to:
  19. <ul>
  20. <li>Make the spelling-to-phoneme translation rules more accurate, including the position of stressed
  21. syllables within words. Some languages are easier than others. I expect most are easier than English.
  22. <p><li>Improve the sounds of the phonemes. This may consist of making small adjustments to vowel and diphthong quality,
  23. or adjusting the strength of consonants. Bigger changes may be recording new or replacement consonant
  24. sounds, or even writing program code to implement new types of sounds.
  25. <p><li>Marking some common words in the dictionary that should be unstressed (words such as "the", "is"), or should be preceded
  26. by a short pause (such as "and", "but"), or have other attributes, in order to make the speech flow better.
  27. <p><li>Improve the rhythm of the speech by adjusting the relative lengths of vowels in different contexts, eg. stressed/unstressed syllable,
  28. or depending on the following phonemes. This is important for making the speech sound good for the language.
  29. <p><li>Identify or implement new functions in the program to improve the speech, or to deal with
  30. characteristics of the language which are not currently implemented. For example, a different intonation module.
  31. </ul>
  32. <b><em>If you are interested in working on a language, please contact me to set up the initial data and to
  33. discuss the features of the language.</em></b>
  34. <HR>
  35. <H3>6.1 Language Code</H3>
  36. <P>Generally, the language's international <a href="http://en.wikipedia.org/wiki/ISO_639-1">ISO 639-1 code</a> is used to
  37. identify the language. It is used in the filenames which
  38. contains the language's data. In the examples below the code &quot;<B>en</B>&quot;
  39. (English) is used as an example. Replace this with the code of your
  40. language.<p>
  41. It is possible to have different variants of a language, for example where the sound of some phonemes changed,
  42. or where some of the pronunciation rules differ.
  43. <HR>
  44. <H3>6.2 Phoneme File</H3>
  45. <P>You must first decide on the set of phonemes to be used for the
  46. language. These should be listed and defined in a phonemes file such as
  47. <B>ph_english</B>. A reference to this file is then included at the end of
  48. the <B>phonemes,</B> file (the master phoneme file), eg:</P>
  49. <PRE> phonemetable en base
  50. include ph_english</PRE><P>
  51. This example defines a phoneme table &quot;<B>en</B>&quot; which inherits
  52. the contents of phoneme table &quot;<B>base</B>&quot;. Its contents are
  53. found in the file <B>ph_english</B>.</P>
  54. <P>The <B>base</B> phoneme table contains definitions of a basic set of
  55. consonants, and also some &quot;control&quot; phonemes such as stress marks and
  56. pauses. The phoneme table for a language will generally inherit this,
  57. or alternatively it may inherit the phoneme table of another language
  58. which in turn inherits the <B>base</B> phoneme table.</P>
  59. <P>The phonemes file for the language defines those additional
  60. phonemes which are not inherited (generally the vowels and diphthongs, plus any additional
  61. consonants), or phonemes whose definitions differ from the
  62. inherited version (eg. the redefinition of a consonant).</P>
  63. <P>Details of the contents of phonemes files are given in
  64. <A href="phontab.html">phontab.html</A>.</P>
  65. The <B>Compile phoneme data</B> function of the <B>espeakedit</B>
  66. program compiles the phonemes files to produce the files
  67. <B>espeak-data/phontab</B>, <B>phonindex</B>, and <B>phondata.</B><P>
  68. For information on how to analyse recorded sounds of the language and to
  69. prepare the corresponding phoneme data, see <a href="editor_if.html">espeakedit</a> and <a href="analyse.html">analysis</a>).<p>
  70. For an initial draft a language will often be able to use vowels and
  71. consonants which have already been set up for another language.
  72. <HR>
  73. <H3>6.3 Dictionary Files</H3>
  74. <P STYLE="font-weight: medium">Once the language's phonemes have been
  75. defined, then pronunciation dictionary data can be produced in order
  76. to translate the language's source text into phonemes. This consists
  77. of two source files: <B>en_rules</B> (the spelling to phoneme rules) and
  78. <B>en_list</B> (an exceptions list, and attributes of certain words). The corresponding compiled data
  79. file is <B>espeak-data/en_dict</B> which is produced from <B>en_rules</B>
  80. and <B>en_list</B> sources by the command: <B>speak&nbsp; --compile=en</B>.</P>
  81. <P STYLE="font-weight: medium">Details of the contents of the
  82. dictionary files are given in <A href="dictionary.html">dictionary.html</A>.</P>
  83. <P STYLE="font-weight: medium">The <B>en_list</B> file contains not
  84. only pronunciation exceptions, but also gives attributes to specific
  85. words, Most notable of these are:</P>
  86. <P STYLE="font-weight: medium"><B>$u </B>Some common words should be
  87. marked as &quot;unstressed&quot; in order to make the speech flow better.
  88. These words generally include articles (eg: a, the, this, that),
  89. auxillary verbs (eg: is, have, will, can, may), pronouns and
  90. possessive adjectives (eg: he, his), some common prepositions (eg:
  91. of, to, in, of), some common conjunctions (eg. and, or, if)., some
  92. common adverbs and adjectives (eg. any, already)</P>
  93. <P><B>$pause </B>Some words should be marked to have a short pause
  94. before then, in order to produce natural pauses in long sentences.
  95. These include conjunctions (eg. and, or, but, however) and perhaps
  96. some prepositions.</P>
  97. <HR>
  98. <H3>6.4 Voice File</H3>
  99. <P STYLE="font-weight: medium">Each language should have one or more
  100. voice files in <B>espeak-data/voices</B>. The filename of the default voice
  101. for a language should be the same as the language code.</P>
  102. <P STYLE="font-weight: medium">Details of the contants of voice files
  103. are given in <A href="voices.html">voices.html</A>.</P>
  104. <P STYLE="font-weight: medium">The simplest voice file would contain
  105. just a single line to give the language code, eg:</P>
  106. <PRE STYLE="margin-bottom: 0.5cm"> language en</PRE><P STYLE="font-weight: medium">
  107. This language code specifies the phoneme table (i.e. <b>phonemetable en</b> and the
  108. dictionary (i.e. <B>espeak-data/en_dict</B>) to be used. If needed, these can be
  109. overridden by <B>phonemes</B> and <B>dictionary</B> attributes in the
  110. voices file.</P>
  111. <HR>
  112. <H3>6.5 Program Code</H3>
  113. <P STYLE="font-weight: medium">The behaviour of the speak program is
  114. controlled by various options (eg. whether words are stressed on the first,
  115. last, or penultimate syllable). The function <B>SetTranslator()</B> at the
  116. start of the <B>tr_languages.cpp</B> file recognizes the language
  117. code and sets the appropriate set of options.</P>
  118. <P STYLE="font-weight: medium">For a new language, you would add its
  119. language code and the required options in <B>SetTranslator()</B>. However, this
  120. may not be necessary during testing because most of the options can also be
  121. set from the voice file in
  122. <B>espeak-data/voices</B>.</P>
  123. <P STYLE="font-weight: medium">If necessary, you can define a new
  124. translator class for a language, and select this in the
  125. SetTranslator() function. This inherits the standard functions
  126. from the base translator class, but allows you to replace these where
  127. needed by new functions which are written specially for this
  128. language.</P>
  129. </BODY>
  130. </HTML>