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 8.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. It may be that a phoneme should sound different depending on adjacent sounds, or whether it's at the start or the end of a word, between vowels, etc. 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. <p>
  35. For most of the eSpeak voices, I do not speak or understand the language, and I do not know how it should sound. I can only make improvements as a result of feedback from speakers of that language. If you want to help to improve a language, listen carefully and try to identify individual errors, either in the spelling-to-phoneme translation, the position of stressed syllables within words, or the sound of phonemes, or problems with rhythm and vowel lengths.
  36. <HR>
  37. <H3>6.1 Language Code</H3>
  38. <P>Generally, the language's international <a href="http://en.wikipedia.org/wiki/ISO_639-1">ISO 639-1 code</a> is used to
  39. identify the language. It is used in the filenames which
  40. contains the language's data. In the examples below the code &quot;<B>en</B>&quot;
  41. (English) is used as an example. Replace this with the code of your
  42. language.<p>
  43. It is possible to have different variants of a language, for example where the sound of some phonemes changed,
  44. or where some of the pronunciation rules differ.
  45. <HR>
  46. <H3>6.2 Phoneme File</H3>
  47. <P>You must first decide on the set of phonemes to be used for the
  48. language. These should be listed and defined in a phonemes file such as
  49. <B>ph_english</B>. A reference to this file is then included at the end of
  50. the <B>phonemes,</B> file (the master phoneme file), eg:</P>
  51. <PRE> phonemetable en base
  52. include ph_english</PRE><P>
  53. This example defines a phoneme table &quot;<B>en</B>&quot; which inherits
  54. the contents of phoneme table &quot;<B>base</B>&quot;. Its contents are
  55. found in the file <B>ph_english</B>.</P>
  56. <P>The <B>base</B> phoneme table contains definitions of a basic set of
  57. consonants, and also some &quot;control&quot; phonemes such as stress marks and
  58. pauses. The phoneme table for a language will generally inherit this,
  59. or alternatively it may inherit the phoneme table of another language
  60. which in turn inherits the <B>base</B> phoneme table.</P>
  61. <P>The phonemes file for the language defines those additional
  62. phonemes which are not inherited (generally the vowels and diphthongs, plus any additional
  63. consonants), or phonemes whose definitions differ from the
  64. inherited version (eg. the redefinition of a consonant).</P>
  65. <P>Details of the contents of phonemes files are given in
  66. <A href="phontab.html">phontab.html</A>.</P>
  67. The <B>Compile phoneme data</B> function of the <B>espeakedit</B>
  68. program compiles the phonemes files to produce the files
  69. <B>espeak-data/phontab</B>, <B>phonindex</B>, and <B>phondata.</B><P>
  70. For information on how to analyse recorded sounds of the language and to
  71. prepare the corresponding phoneme data, see <a href="editor_if.html">espeakedit</a> and <a href="analyse.html">analysis</a>).<p>
  72. For an initial draft a language will often be able to use vowels and
  73. consonants which have already been set up for another language.
  74. <HR>
  75. <H3>6.3 Dictionary Files</H3>
  76. <P STYLE="font-weight: medium">Once the language's phonemes have been
  77. defined, then pronunciation dictionary data can be produced in order
  78. to translate the language's source text into phonemes. This consists
  79. of two source files: <B>en_rules</B> (the spelling to phoneme rules) and
  80. <B>en_list</B> (an exceptions list, and attributes of certain words). The corresponding compiled data
  81. file is <B>espeak-data/en_dict</B> which is produced from <B>en_rules</B>
  82. and <B>en_list</B> sources by the command: <B>speak&nbsp; --compile=en</B>.</P>
  83. <P STYLE="font-weight: medium">Details of the contents of the
  84. dictionary files are given in <A href="dictionary.html">dictionary.html</A>.</P>
  85. <P STYLE="font-weight: medium">The <B>en_list</B> file contains not
  86. only pronunciation exceptions, but also gives attributes to specific
  87. words, Most notable of these are:</P>
  88. <P STYLE="font-weight: medium"><B>$u </B>Some common words should be
  89. marked as &quot;unstressed&quot; in order to make the speech flow better.
  90. These words generally include articles (eg: a, the, this, that),
  91. auxillary verbs (eg: is, have, will, can, may), pronouns and
  92. possessive adjectives (eg: he, his), some common prepositions (eg:
  93. of, to, in, of), some common conjunctions (eg. and, or, if)., some
  94. common adverbs and adjectives (eg. any, already)</P>
  95. <P><B>$pause </B>Some words should be marked to have a short pause
  96. before then, in order to produce natural pauses in long sentences.
  97. These include conjunctions (eg. and, or, but, however) and perhaps
  98. some prepositions.</P>
  99. <HR>
  100. <H3>6.4 Voice File</H3>
  101. <P STYLE="font-weight: medium">Each language should have one or more
  102. voice files in <B>espeak-data/voices</B>. The filename of the default voice
  103. for a language should be the same as the language code.</P>
  104. <P STYLE="font-weight: medium">Details of the contants of voice files
  105. are given in <A href="voices.html">voices.html</A>.</P>
  106. <P STYLE="font-weight: medium">The simplest voice file would contain
  107. just a single line to give the language code, eg:</P>
  108. <PRE STYLE="margin-bottom: 0.5cm"> language en</PRE><P STYLE="font-weight: medium">
  109. This language code specifies the phoneme table (i.e. <b>phonemetable en</b> and the
  110. dictionary (i.e. <B>espeak-data/en_dict</B>) to be used. If needed, these can be
  111. overridden by <B>phonemes</B> and <B>dictionary</B> attributes in the
  112. voices file.</P>
  113. <HR>
  114. <H3>6.5 Program Code</H3>
  115. <P STYLE="font-weight: medium">The behaviour of the speak program is
  116. controlled by various options (eg. whether words are stressed on the first,
  117. last, or penultimate syllable). The function <B>SetTranslator()</B> at the
  118. start of the <B>tr_languages.cpp</B> file recognizes the language
  119. code and sets the appropriate set of options.</P>
  120. <P STYLE="font-weight: medium">For a new language, you would add its
  121. language code and the required options in <B>SetTranslator()</B>. However, this
  122. may not be necessary during testing because most of the options can also be
  123. set from the voice file in
  124. <B>espeak-data/voices</B>.</P>
  125. <P STYLE="font-weight: medium">If necessary, you can define a new
  126. translator class for a language, and select this in the
  127. SetTranslator() function. This inherits the standard functions
  128. from the base translator class, but allows you to replace these where
  129. needed by new functions which are written specially for this
  130. language.</P>
  131. </BODY>
  132. </HTML>