Debian Codegraph @

docs/languages/gmw/lb.md

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 ## Introduction
2 The present fork adds [Luxembourgish](https://en.wikipedia.org/wiki/Luxembourgish) as 127th language to the eSpeak-NG text-to-speech (TTS) synthesizer (version.1.50.1).
3
4 The main purpose of the project is the creation of a rule based International Phonetic Alphabet ([IPA](https://en.wikipedia.org/wiki/International_Phonetic_Alphabet)) phonemizer for transcriptions of luxembourgish audio utterances.
5
6 The phonemized text allows to create and use luxembourgish high-quality synthetic voices, trained with deep machine learning (ML) speech models, based on neural networks.
7
8 The speech generated with the associated eSpeak-NG sound engine is based on formant synthesis techniques and is of low quality. The related luxembourgish voice `Luxi` is intelligible, but I did no sound optimization because my focus is put on the phonemization front-end process.
9
10 ## Luxembourgish customization
11 Four files are needed to include Luxembourgish as additional language in the eSpeak-NG project :
12
13 * [phsource/ph_luxembourgish](https://github.com/mbarnig/espeak-ng-lb/blob/lëtzebuergesch/phsource/ph_letzebuergesch)
14 * [dictsource/lb_rules](https://github.com/mbarnig/espeak-ng-lb/blob/lëtzebuergesch/dictsource/lb_rules)
15 * [dictsource/lb_list](https://github.com/mbarnig/espeak-ng-lb/blob/lëtzebuergesch/dictsource/lb_list)
16 * [dictsource/lb_emoji](https://github.com/mbarnig/espeak-ng-lb/blob/lëtzebuergesch/dictsource/lb_emoji)
17
18 The customization process can be splitted into two steps :
19
20 1. convert the characters (graphemes) of text into [phonetic descriptions](https://en.wikipedia.org/wiki/Luxembourgish_phonology) (phoneme-ID's)
21 2. convert the phoneme-ID's into [IPA phonemes](https://en.wikipedia.org/wiki/Help:IPA/Luxembourgish) and define instructions how to generate sounds for each phoneme.
22
23 eSpeak-NG is an evolution of the famous speak-program for the [ACORN/RISC_OS](https://en.wikipedia.org/wiki/RISC_OS) computers developed in 1995 by Jonathan Duddington. In 2007 the program was renamed [eSpeak](https://en.wikipedia.org/wiki/ESpeak). After the disappearance of the original developer early 2015, a new project eSpeak-NG (new generation) was started in December 2015 under the direction of [Reece H. Dunn](https://github.com/rhdunn).
24
25 When speak was created the phoneme-ID's were based on the text encoding ASCII, available at this time. This was never changed in the eSpeak-NG fork to avoid too much divergence from the original code. A few years ago, the support of IPA names in the output was added, but this work-around is still laborious, compared to a state-of-art solution where IPA names are used as phoneme-ID's. The current problems with the eSpeak-NG architecture are stated in this [roadmap](https://github.com/espeak-ng/espeak-ng/wiki/eSpeak-NG-roadmap) document.
26
27 Let's start to describe the `ph_luxembourgish` file which is the heart of the whole process.
28
29 ### Phoneme inventory
30 We distinguish two types of phonemes : [vowels]( https://en.wikipedia.org/wiki/Vowel) ([monophtongs](https://en.wikipedia.org/wiki/Monophthong) and [diphtongs](https://en.wikipedia.org/wiki/Diphthong)) and [consonants](https://en.wikipedia.org/wiki/Consonant).
31
32 I use the word `Auto` with two vowels `au, o` and one consonant `t` to explain the definition of the related phonemes in the `ph_luxembourgish` file. The code is formed by simple text strings. The minimal code for the word `Auto` has the following format :
33
34 ```
35 phoneme aU
36 vwl starttype #a endtype #u
37 ipa ɑʊ
38 length 190
39 FMT(vdiph/au)
40 endphoneme
41
42 phoneme t
43 vls alv stp
44 ipa t
45 WAV(ustop/t, 90)
46 endphoneme
47
48 phoneme o:
49 vwl starttype #o endtype #o
50 ipa oː
51 length 170
52 FMT(vowel/o)
53 endphoneme
54 ```
55
56 The minimal phoneme definition includes 5 parts :
57
58 * the term `phoneme` followed by the phoneme-ID
59 * the description of the articulation
60 * the IPA symbol
61 * the parameters for the sound generation (length, FMT, WAV, etc)
62 * the closing term `endphoneme`
63
64 To specify the sound generation for a phoneme, eSpeak-NG provides a whole set of specific parameters and conditions for fine-tuning. A typical more complex example is shown hereafter :
65
66 ```
67 phoneme t
68 vls alv stp
69 voicingswitch d
70 lengthmod 2
71 Vowelin f1=0 f2=1700 -300 300 f3=-100 80
72 Vowelout f1=0 f2=1700 -300 250 f3=-100 80 rms=20
73
74 IF nextPh(isPause2) THEN
75 WAV(ustop/t_)
76 ELIF nextPh(r) THEN
77 WAV(ustop/t_)
78 ELIF nextPh(@-) THEN
79 WAV(ustop/t_dnt, 50)
80 ENDIF
81 WAV(ustop/t, 90)
82 endphoneme
83 ```
84 I mentionned in the introduction that my goal is not the perfect sound design. Therefore I specified the strict minimum of parameters for each phoneme. [Interested users](https://github.com/espeak-ng/espeak-ng/issues/1013) can easely modify the code to enhance the speech quality. The official documentation provides the necessary guidance :
85
86 * [Phoneme Model](https://github.com/espeak-ng/espeak-ng/blob/master/docs/phoneme_model.md)
87 * [Phoneme features and IPA](https://github.com/espeak-ng/espeak-ng/blob/master/docs/phonemes.md)
88 * [Phoneme Tables](https://github.com/espeak-ng/espeak-ng/blob/master/docs/phontab.md)
89
90 It is not necessary to specify all the phonemes for a language, they can be inherited from a `master phoneme file` or from another language. Most of the 126 languages supported by eSpeak-NG use this mecanism. Some languages even rely only on inherited phoneme definitions.
91
92 To get the full control of the phonemization process and to rest independent from code changes in other languages, I prefer however to define all the used phonemes for the luxembourgish language.
93
94 Speech models based on deep ML models are usually trained with about hundred hours of audio records and related transcriptions. To train a deep ML neural network with small datasets, which is the case for Luxembourgish, it is necessary to use a low number of different phonemes to obtain valid results. Based on my earlier experience with ML-TTS models I selected the following sets of phonemes (total : 56) for this first release of my project :
95
96 ```
97 Monophtongs: (20)
98 IPA phoneme symbols : ɑ, aː, ɛː, e, æ, eː, ə, ɐ, i, iː, o, oː, u, uː, y, yː, ɑ̃ː, ɛ̃ː, õː, œː
99 my eSpeak phoneme-ID's : a, a:, aE, e, E, e:, @E, eR, i, i:, o, o:, u, u:, y, y:, eA, iA, oA, OU
100
101 Diphtongs: (9)
102 IPA phoneme symbols : æːɪ, ɑʊ, æːʊ, ɑɪ, ɜɪ, oɪ, iə, əʊ, uə
103 my eSpeak phoneme-ID's : aI, aU, AU, eI, OI, eU, iE, oU, uE
104
105 Consonants: (27)
106 IPA phoneme symbols b, c, d, f, g, h, j, k, l, m, n, ŋ, p, ʀ, s, t, v, w, z, ʒ, ʁ, ʑ, ʦ, ʃ, dʒ, X, ɕ
107 my eSpeak phoneme-ID's : b, c, d, f, g, h, j, k, l, m, n, N, p, r, s, t, v, w, z, J, rR, Z, TS, S, dZ, x, X
108 ```
109 To add more phonemes, if required in the future, it's easy to modify the `ph_luxembourgish` file and to adapt the related files `lb_rules`, `lb_list` and `lb_emoji`.
110
111 In the next chapter I will describe the process to link letters (characters, graphemes) to phoneme-ID's.
112
113 ### Text to Phoneme translation
114 #### lb_rules
115 The main file to define the translation (correspondence) between letters and phoneme-ID's is [lb_rules](https://github.com/mbarnig/espeak-ng-lb/blob/lëtzebuergesch/dictsource/lb_rules). It's a sort of large table with the following format, starting with a `.group` line :
116
117 ```
118 .group <one character>
119
120 or
121
122 .group <two characters>
123
124 then
125
126 previous letter sequence ) current letter sequence ( next letter sequence phoneme-ID's sequence // eventually comments
127 ```
128
129 Let's take again the `Auto` example to explain the text code by considering that the the word starts with the dipthtong `au`, followed by the consonant `t`. The word ends with the monophtong `o`, preceded by the consonant `t`. The consonant `t` itself is preceded by the dipthtong `au` and followed by the monophtong `o`.
130
131 ```
132 .group aU
133 _) au (t aU
134
135 .group o
136 t) o (_ o:
137
138 .group t
139 au) t (o t
140 ```
141 Again, eSpeak-NG provides a large set of specific commands and parameters to define the translation rules in a very detailed and comprehensive manner. A simple example are the capital letter A which indicates any vowel and the capital letter C which indicates any consonant. If we use A and C in the above example, we can easely define the rules to phonemize the words `Aula` and `Auto` with combined code :
142
143 ```
144 .group aU
145 _) au (C aU
146
147 .group o
148 C) o (_ o:
149
150 .group a
151 C) a (_ a:
152
153 .group t
154 A) t (A t
155
156 .group l
157 A) l (A l
158 ```
159 Another way for coding to obtain the same result is :
160
161 ```
162 .group aU
163 _) au (C aU
164
165 .group to
166 A) to (_ to:
167
168 .group la
169 A) la (_ la:
170 ```
171 To find the pronunciation of a word, the rules are searched and any which match the letters at the current position in the word are given a score, depending on how many letters are matched. The pronunciation from the best matching rule is chosen. The position pointer inside the word is then advanced past those consumed letters which have been matched and the process is repeated until all the letters of the word have been processed.
172
173 There are numerous possibilities to code the phonemization rules with `prev`, `current` and `post` letter sequences (or placeholders, symbols, options, letter groups with some common features, etc).
174
175 There are also some restrictions. The first letter of a rule-group-ID with two letters must be a 7bit-ASCII character (less than 0x80). In the case of a one-letter-group-ID extended ASCII-characters are accepted (as `è ö î` etc).
176
177 The guide [Text to Phoneme Translation](https://github.com/espeak-ng/espeak-ng/blob/master/docs/dictionary.md) provides all available options to set up a complete and complex translation table. I opted however for a few simple rules because I have a preference to include a luxembourgish pronunciation lexicon into the file `lb_list` described below. This way I take into account that Luxembourgish contains numerous loanwords from german, french and english, which makes the definition of global rules more difficult.
178
179 An interested user can easely extend and adapt the rules in the `lb_rules` file to his own needs.
180
181 #### lb_list
182 Usually a text to synthesize does not only contain common words from a specific language, but also punctuations, numbers, symbols, personal names, abbreviations, loanwords and eventually [Speech Synthesis Markup Language](https://en.wikipedia.org/wiki/Speech_Synthesis_Markup_Language) (SSML) code. These exceptions are handled in the [lb_list](https://github.com/mbarnig/espeak-ng-lb/blob/lëtzebuergesch/dictsource/lb_list). It's a simple text lexicon with the following entries :
183 ```
184 letter-name phoneme-ID or $accent
185 word phoneme-ID sequence
186 word other similar word $text
187 word (stressed, unstressed, ..) $u // intonation
188 abbreviation phoneme-ID sequence or $$abbrev
189 number phoneme-ID sequence
190 symbol phoneme-ID sequence
191 ```
192
193 Here is a small excerpt from the luxembourgish `lb_list` file to show the principles :
194
195 ```
196 // letter names
197 _a a:
198 _e e:
199 ä $accent
200 û $accent
201 // intonation
202 de $u // unstress
203 den $u
204 // numbers
205 _0 nul
206 _1 e:nt
207 _2 TSve:
208 _0C honert
209 _0M1 daUz@End
210 // punctuations
211 _. punkt
212 _, koma
213 // symbols
214 + pluz
215 & an
216 € eUro
217 CSV $abbrev
218 OGBL $abbrev
219 asbl $abbrev
220 ASCII azki
221 // personal names
222 Marco marko:
223 Barnig barniS
224 Simone zimon
225 ```
226 The flag $accent tells the processor to say the letter name, followed by the name of the [diacritics](https://en.wikipedia.org/wiki/Diacritic). The flag $abbrev indicates to say the letter names in sequence. Speaking the names of punctuations works only if the flag `--punc` is specified at inference.
227
228 Again, eSpeak-NG offers a lot of options to finetune the list entries. My `lb_list` file for the first version of this project is work in progress. I will update it progressively to comply to my needs. An interested user can do the same.
229
230 Note: the supported SSML tags are documented in the document [SSML and HTML Support](https://github.com/mbarnig/espeak-ng-lb/blob/lëtzebuergesch/docs/markup.md).
231
232 #### lb_emoji
233 Today, graphics are gaining more and more importance in text. For this reason eSpeak-NG replaced the former file `language_extra` by a file called `language_emoji`. [Emoji's](https://en.wikipedia.org/wiki/Emoji) are small pictures which can be represented as encoded characters. Originating on Japanese mobile phones in 1997, emoji's became increasingly popular worldwide in the 2010s after being added to several mobile operating systems. To assure an interoperability between browsers, mobiles and messaging systems, the emoji's are standardized since 2014 by the [Unicode Consortium](https://en.wikipedia.org/wiki/Unicode_Consortium). Every year additional emoji's are added to the standard upon public proposals.
234
235 The [full list of emoji's](https://unicode.org/emoji/charts/full-emoji-list.html) is available at the home-page of the Unicode Consortium.
236
237 Here are two examples how to include emoji's (graphics) in a luxembourgish sentence to submit to the eSpeak-NG phonemizer :
238
239 An der &#x1F570; hunn sech den &#x1F9ED;&#x1F4A8; an d’&#x1F31E; gestridden, wie vun hinnen zwee wuel méi &#x1F4AA; wier, wéi e &#x1F6B6;, deen an ee waarme &#x1F9E5; agepak war, iwwert de &#x1F6E4; koum.
240
241 Haut sinn &#x261D; mat mengen Enkelkanner &#x1F9D1;&#x200D;&#x1F91D;&#x200D;&#x1F9D1; , &#x1F466; , &#x1F467; , an &#x1F469; an den &#x1F3AA; gaangen. Do hunn mer e &#x1F98D;, eng &#x1F992;, en &#x1F418; an en &#x1F98F; gesinn.
242
243 To phonemize the above sentences I added the following entries into the [lb_emoji](https://github.com/mbarnig/espeak-ng-lb/blob/lëtzebuergesch/dictsource/lb_emoji) file :
244
245 ```
246 &#x1F570; TSaIt
247 &#x1F9ED; nort
248 &#x1F32C; vant
249 &#x1F31E; zon
250 &#x1F4AA; Sta:rk
251 &#x1F6B6; vand@EreR
252 &#x1F9E5; mant@El
253 &#x1F6E4; ve:
254 &#x261D; eS
255 &#x1F9D1;&#x200D;&#x1F91D;&#x200D;&#x1F9D1; Sa:rel, toma:
256 &#x1F466; asto:r
257 &#x1F467; kapuzin
258 &#x1F469; tessa
259 &#x1F3AA; TSirkus
260 &#x1F98D; gorila:
261 &#x1F992; giraf
262 &#x1F418; elefant
263 &#x1F98F; rino:zerus
264 ```
•265 A more comfortable option is to insert emoji's from the popup menu in the text-editor
266
267 Here are the results of the phonemization :
268
269 ```
270 ɑn dɐ ‚ʦæ:ɪt / hun zeɕ dən ’noʀtvɑnt ɑn ‚dzon gə’ʃtʀidən / viə fun hinən ‚ʦve: vuəl ‚meɪ ʃta:ʀk viɐ / veɪ eː ‚vɑndəʀɐ / de:n ɑn eː ‚va:ʀmə ‚mɑntəl ‚a:ɡəpa:k va:ʀ / ivɐt də ‚veː kəʊm //
271
272 haUt sin eS mat mengen enkelkaneR Sa:rel / toma: / asto:r / kapuzin an tessa an den TSirkus ga:ngen // do: hun meR e gorila: / eN giraf / en elefant an e rino:zerus gesin //
273 ```
274
275 For convenience I moved the symbols from the `lb_list` file to the `lb_emoji` file.
276
277 ## Integration
278 In the last step the four luxembourgish files are embedded into the source code of the eSpeak-NG project. The following source files are modified :
279
280 * [Makefile.am](https://github.com/mbarnig/espeak-ng-lb/blob/master/Makefile.am)
281 * [phsource/phonemes](https://github.com/mbarnig/espeak-ng-lb/blob/master/phsource/phonemes)
282 * [docs/languages.md](https://github.com/mbarnig/espeak-ng-lb/blob/master/docs/languages.md)
283
284 In the `Makefile.am` file I added the following lines :
285
286 in position 392 :
287 ```
288 phsource/ph_luxembourgish \
289 ```
290 in position 570 :
291 ```
292 espeak-ng-data/lb_dict \
293 ```
294 in position 792 :
295 ```
296 lb: espeak-ng-data/lb_dict
297 espeak-ng-data/lb_dict: dictsource/lb_list dictsource/lb_rules dictsource/lb_emoji
298 ```
299 In the `phsource/phonemes` file I added these lines at position 1763 :
300 ```
301 phonemetable lb base1
302 include ph_luxembourgish
303 ```
304 In the `docs/languages.md` file I added this line after the latin language :
305
306 `gmw` | `lb` | West Germanic | Lëtzebuergesch
307
308 Two additional files must be created :
309 * [espeak-ng-data/lang/gmw/lb](https://github.com/mbarnig/espeak-ng-lb/blob/lëtzebuergesch/espeak-ng-data/lang/gmw/lb)
310 * [espeak-ng-data/voices/!v/Luxi](https://github.com/mbarnig/espeak-ng-lb/blob/lëtzebuergesch/espeak-ng-data/voices/!v/Luxi)
311
312 Both files are very simple if we include only the strict minimum.
313
314 Here comes the content of the language file `lb` :
315 ```
316 name Lëtzebuergesch
317 language lb
318 ```
319 Here is the voice file `Luxi` :
320 ```
321 name Luxi
322 language lb
323 maintainer mbarnig
324 ```
325 As usual, eSpeak-NG provides numerous options to customize these files. Please read the guide [Voice and Language files](https://github.com/mbarnig/espeak-ng-lb/blob/lëtzebuergesch/docs/voices.md) to get a detailed documentation about all available features.
326 folder
327 When building the project the first time, an additional file `lb_dict` is created inside the folder [espeak-ng-data](https://github.com/mbarnig/espeak-ng-lb/tree/l%C3%ABtzebuergesch/espeak-ng-data), which is a compressed binary combination of the three files `lb_rules`, `lb_list` and `lb_emoji`.
328
329 ## Build and use the project
330 Now the forked eSpeak-NG source code is ready for compilation, hopefully without problems. Compilation is easy if you have a personal computer with a well configured development environment and all required tools for C-compilation. On my Ubuntu 20.04 system this is the case and I build and install the project with 4 commands :
331
332 ```
333 ./autogen.sh
334 ./configure
335 make
336 sudo make install
337 ```
338
339 The [building guide](https://github.com/mbarnig/espeak-ng-lb/blob/master/docs/building.md) provides detailed info how to compile and build eSpeak NG from the source on different operating systems. If you need help, please visit the [issues section](https://github.com/espeak-ng/espeak-ng/issues) from the master eSpeak-NG project. Currently there are 333 open and 311 closed issues, so probably another user found already a solution for your problem.
340
341 To use the project, I need only one command :
342
343 `espeak-ng -v lb -q --ipa -f <text file>`
344
345 The content of the text file is phonemized with luxembourgish rules (flag `-v lb`) with IPA symbols (flag `--ipa`), without producing speech (flag `-q`). All the optional configuration flags are explained in the [--help document](https://github.com/mbarnig/espeak-ng-lb/blob/lëtzebuergesch/src/espeak-ng.1.ronn).
346
347 A more comfortable option is to use the great tool [espeak-phonemizer](https://github.com/rhasspy/espeak-phonemizer), created by [Michael Hansen](https://www.linkedin.com/in/michael-hansen-9885b2105/) (alias [synesthesiam](https://synesthesiam.com)), which transforms the output from espeak-NG in a format ready for submission as input to train a deep machine learning luxembourgish TTS model, based on neural networks.
348
349 My favorite Github projects for my luxembourgish ML-TTS experiments are :
350
351 * [Rhasppy/Larynx](https://github.com/rhasspy/larynx)
352 * [Coqui-TTS](https://github.com/coqui-ai/TTS)
353 * [Implementations by Keon Lee](https://github.com/keonlee9420)
354 * [Implementations by Jaehyeon Kim](https://github.com/jaywalnut310)
355
356
357 ## References
358 * [The best of two breeds](https://www.web3.lu/the-best-of-two-breeds/), 2021, mbarnig
359 * [Synthèse de la parole](https://www.amazon.fr/Synthèse-parole-électrique-électronique-informatique/dp/2322238600/), 2020, Marco Barnig
360 * [Synthèse vocale](https://www.web3.lu/synthese-vocale/), 2019, mbarnig
361 * [Emojis et Unicode](https://www.web3.lu/timeline/emojis-et-unicode/), 2018, mbarnig
362 * [Evolution of character encoding](https://www.web3.lu/evolution-of-character-encoding/), 2016, mbarnig
363 * [Speech Corpora for TTS](https://www.web3.lu/speech-corpora-tts/), 2015, mbarnig
364 * [Festival Text-to-Speech Package](https://www.web3.lu/festival-text-speech-package/), 2015, mbarnig
365 * [eSpeak Formant Synthesizer](https://www.web3.lu/espeak-formant-synthesizer/), 2014, mbarnig
366 * [Mary TTS (Text To Speech)](https://www.web3.lu/marytts-text-speech/), 2014, mbarnig
367 * [Language : fr, de, en, lb, eo](https://www.web3.lu/languages/), 2014, mbarnig
368 * [Spectrograms and speech processing](https://www.web3.lu/spectrogram-speech-processing/), 2014, mbarnig
369 * [Phonemes, phones, graphemes and visemes](https://www.web3.lu/phonemes-phones-graphemes-visemes/), 2014, mbarnig
370 * [FreeTTS : a Java speech synthesizer](https://www.web3.lu/freetts-a-java-speech-synthesizer/), 2005, mbarnig