|
|
|
|
|
|
|
|
# Table of contents |
|
|
# Adding or Improving a Language |
|
|
|
|
|
|
|
|
* [Adding or improving a language](#adding-or-improving-a-language) |
|
|
- [Language Code](#language-code) |
|
|
* [Language Code](#language-code) |
|
|
- [Language Files](#language-files) |
|
|
* [Language Files](#language-files) |
|
|
- [Voice File](#voice-file) |
|
|
* [Voice File](#voice-file) |
|
|
- [Phoneme Definition File](#phoneme-definition-file) |
|
|
* [Phoneme Definition File](#phoneme-definition-file) |
|
|
- [Dictionary Files](#dictionary-files) |
|
|
* [Dictionary Files](#dictionary-files) |
|
|
- [Program Code](#program-code) |
|
|
* [Program Code](#program-code) |
|
|
- [Improving a Language](#improving-a-language) |
|
|
* [Improving a Language](#improving-a-language) |
|
|
|
|
|
|
|
|
|
|
|
# Adding or improving a language |
|
|
---------- |
|
|
|
|
|
|
|
|
Most of the work doesn't need any programming knowledge. Just an |
|
|
Most of the work doesn't need any programming knowledge. Just an |
|
|
understanding of the language, an awareness of its features, patience |
|
|
understanding of the language, an awareness of its features, patience |
|
|
and attention to detail. Wikipedia is a good source of basic phonetic |
|
|
and attention to detail. Wikipedia is a good source of basic phonetic |
|
|
information, eg |
|
|
information, e.g. |
|
|
[http://en.wikipedia.org/wiki/Vowel](http://en.wikipedia.org/wiki/Vowel). |
|
|
[http://en.wikipedia.org/wiki/Vowel](http://en.wikipedia.org/wiki/Vowel). |
|
|
|
|
|
|
|
|
In many cases it should be fairly easy to add a rough implementation of |
|
|
In many cases it should be fairly easy to add a rough implementation of |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Language Code |
|
|
## Language Code |
|
|
|
|
|
|
|
|
Generally, the language's international [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) code is used to identify |
|
|
Generally, the language's international |
|
|
|
|
|
[ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) code is used to identify |
|
|
the language. It is used in the filenames which contain the language's |
|
|
the language. It is used in the filenames which contain the language's |
|
|
data. In the examples below the code **"fr"** is used as an example. |
|
|
data. In the examples below the code **"fr"** is used as an example. |
|
|
Replace this with the code of your language. |
|
|
Replace this with the code of your language. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The following files are needed for your language. |
|
|
The following files are needed for your language. |
|
|
|
|
|
|
|
|
|
|
|
* `espeak-data/voices/fr`. The voice file. This gives the language name and |
|
|
The **fr\_rules** and **fr\_list** files are compiled to produce the |
|
|
may set some options. |
|
|
file **espeak-data/fr\_dict**, which eSpeak uses when it is speaking. |
|
|
* `phsource/ph_french`. The phoneme definition file. This contains phoneme |
|
|
|
|
|
definitions for the vowels and consonants which the language uses. Usually |
|
|
|
|
|
it will contain mostly vowels. Most consonants will be inherited from the |
|
|
|
|
|
common phoneme definitions in the master phoneme file, `phsource/phonemes`. |
|
|
|
|
|
The master phoneme file needs to be edited to call your new `ph_french` file. |
|
|
|
|
|
* `dictsource/fr_rules`. This contains the spelling-to-phoneme translation |
|
|
|
|
|
rules. |
|
|
|
|
|
* `dictsource/fr_list`. This contains pronunciations for numbers, letter and |
|
|
|
|
|
symbol names, and words with exceptional pronunciations. It also gives |
|
|
|
|
|
attributes such as "unstressed" and "pause" to some common words. |
|
|
|
|
|
|
|
|
|
|
|
The `fr_rules` and `fr_list` files are compiled to produce the |
|
|
|
|
|
file `espeak-data/fr_dict`, which eSpeak uses when it is speaking. |
|
|
|
|
|
|
|
|
## Voice File |
|
|
## Voice File |
|
|
|
|
|
|
|
|
Each language needs a voice file in **espeak-data/voices** or |
|
|
Each language needs a voice file in `espeak-data/voices` or |
|
|
**espeak-data/voices/test**. The filename of the default voice for a |
|
|
`espeak-data/voices/test`. The filename of the default voice for a |
|
|
language should be the same as the language code (eg. "fr" for French). |
|
|
language should be the same as the language code (eg. "fr" for French). |
|
|
|
|
|
|
|
|
Details of the contents of voice files are given in |
|
|
Details of the contents of voice files are given in [Voices](voices.md). |
|
|
[voices](voices.md). |
|
|
|
|
|
|
|
|
|
|
|
The simplest voice file would contain just 2 lines to give the language |
|
|
The simplest voice file would contain just 2 lines to give the language |
|
|
name and language code, eg: |
|
|
name and language code, eg: |
|
|
|
|
|
|
|
|
name french |
|
|
name french |
|
|
language fr |
|
|
language fr |
|
|
|
|
|
|
|
|
This language code specifies which phoneme table and dictionary to use |
|
|
This language code specifies which phoneme table and dictionary to use |
|
|
(i.e. **phonemetable fr** and **espeak-data/fr\_dict**) to be used. If |
|
|
(i.e. `phonemetable fr` and `espeak-data/fr_dict`) to be used. If |
|
|
needed, these can be overridden by **phonemes** and **dictionary** |
|
|
needed, these can be overridden by `phonemes` and `dictionary` |
|
|
attributes in the voice file. For example you may want to start the |
|
|
attributes in the voice file. For example you may want to start the |
|
|
implementation of a new language by using the phoneme table of an |
|
|
implementation of a new language by using the phoneme table of an |
|
|
existing language. |
|
|
existing language. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You must first decide on the set of phonemes (vowel and consonant |
|
|
You must first decide on the set of phonemes (vowel and consonant |
|
|
sounds) for the language. These should be defined in a phoneme |
|
|
sounds) for the language. These should be defined in a phoneme |
|
|
definition file **ph\_xxxx**, where "ph\_xxxx" is the name of your |
|
|
definition file `ph_xxxx`, where `ph_xxxx` is the name of your |
|
|
language. A reference to this file is then included at the end of the |
|
|
language. A reference to this file is then included at the end of the |
|
|
master phoneme file, **phsource/phonemes**, eg: |
|
|
master phoneme file, `phsource/phonemes`, e.g.: |
|
|
|
|
|
|
|
|
phonemetable fr base |
|
|
phonemetable fr base |
|
|
include ph_french |
|
|
include ph_french |
|
|
|
|
|
|
|
|
This example defines a phoneme table **"fr"** which inherits the |
|
|
This example defines a phoneme table `fr` which inherits the |
|
|
contents of phoneme table **"base"**. Its contents are found in the file |
|
|
contents of phoneme table `base`. Its contents are found in the file |
|
|
**ph\_french**. |
|
|
`ph_french`. |
|
|
|
|
|
|
|
|
The **base** phoneme table contains definitions of a basic set of |
|
|
The `base` phoneme table contains definitions of a basic set of |
|
|
consonants, and also some "control" phonemes such as stress marks and |
|
|
consonants, and also some "control" phonemes such as stress marks and |
|
|
pauses. These are defined in **phsource/phonemes**. The phoneme table |
|
|
pauses. These are defined in `phsource/phonemes`. The phoneme table |
|
|
for a language will inherit these, or alternatively it may inherit the |
|
|
for a language will inherit these, or alternatively it may inherit the |
|
|
phoneme table of another language which in turn inherits the **base** |
|
|
phoneme table of another language which in turn inherits the `base` |
|
|
phoneme table. |
|
|
phoneme table. |
|
|
|
|
|
|
|
|
The phonemes file for the language defines those additional phonemes |
|
|
The phonemes file for the language defines those additional phonemes |
|
|
|
|
|
|
|
|
additional consonants that are needed), or phonemes whose definitions |
|
|
additional consonants that are needed), or phonemes whose definitions |
|
|
differ from the inherited version (eg. the redefinition of a consonant). |
|
|
differ from the inherited version (eg. the redefinition of a consonant). |
|
|
|
|
|
|
|
|
Details of phonemes files are given in |
|
|
Details of phonemes files are given in [Phoneme Tables](phontab.md). |
|
|
[phontab](phontab.md). |
|
|
To build the phoneme files, run: |
|
|
|
|
|
|
|
|
|
|
|
espeak-ng --compile-phonemes |
|
|
|
|
|
|
|
|
The **Compile phoneme data** function of the **espeakedit** program |
|
|
or: |
|
|
compiles the phonemes files of all languages to produce the files |
|
|
make |
|
|
**espeak-data/phontab**, **phonindex**, and **phondata** which are used |
|
|
|
|
|
by eSpeak. |
|
|
|
|
|
|
|
|
|
|
|
For many languages, the consonant phonemes which are already available |
|
|
For many languages, the consonant phonemes which are already available |
|
|
in eSpeak, together with the available vowel files which can be used to |
|
|
in eSpeak, together with the available vowel files which can be used to |
|
|
|
|
|
|
|
|
Once the language's phonemes have been defined, then pronunciation |
|
|
Once the language's phonemes have been defined, then pronunciation |
|
|
dictionary data can be produced in order to translate the language's |
|
|
dictionary data can be produced in order to translate the language's |
|
|
source text into phonemes. This consists of two source files: |
|
|
source text into phonemes. This consists of two source files: |
|
|
**fr\_rules** (the spelling to phoneme rules) and **fr\_list** (an |
|
|
`fr_rules` (the spelling to phoneme rules) and `fr_list` (an |
|
|
exceptions list, and attributes of certain words). The corresponding |
|
|
exceptions list, and attributes of certain words). The corresponding |
|
|
compiled data file is **espeak-data/fr\_dict** which is produced from |
|
|
compiled data file is `espeak-data/fr_dict` which is produced from |
|
|
**fr\_rules** and **fr\_list** sources by the command: |
|
|
the `fr_rules` and `fr_list` sources by the command: |
|
|
|
|
|
|
|
|
`espeak-ng --compile=fr` |
|
|
|
|
|
|
|
|
|
|
|
Or by using the **espeakedit** program. |
|
|
espeak-ng --compile=fr |
|
|
|
|
|
|
|
|
Details of the contents of the dictionary files are given in |
|
|
Details of the contents of the dictionary files are given in |
|
|
[dictionary](dictionary.md). |
|
|
[Dictionary](dictionary.md). |
|
|
|
|
|
|
|
|
The **fr\_list** file contains: |
|
|
The `fr_list` file contains: |
|
|
|
|
|
|
|
|
|
|
|
* Pronunciations which exceptions to the rules in `fr_rules`, (e.g. foreign |
|
|
* Pronunciations which exceptions to the rules in fr_rules, (eg. foreign names). |
|
|
names). |
|
|
* Pronunciation of letter names, symbol names, and punctuation names. |
|
|
* Pronunciation of letter names, symbol names, and punctuation names. |
|
|
* Pronunciation of numbers. |
|
|
* Pronunciation of numbers. |
|
|
* Attributes for words. For example, common function words which should not be stressed, or conjunctions which should be preceded by a pause. |
|
|
* Attributes for words. For example, common function words which should not |
|
|
|
|
|
be stressed, or conjunctions which should be preceded by a pause. |
|
|
|
|
|
|
|
|
## Program Code |
|
|
## Program Code |
|
|
|
|
|
|
|
|
The behaviour of the eSpeak program is controlled by various options |
|
|
The behaviour of the eSpeak program is controlled by various options |
|
|
such as: |
|
|
such as: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* Default rules for which syllable of a word has the main stress. |
|
|
* Default rules for which syllable of a word has the main stress. |
|
|
* Relative lengths and amplitude of vowels in stressed and unstressed syllables. |
|
|
* Relative lengths and amplitude of vowels in stressed and unstressed syllables. |
|
|
* Which intonation tunes to use. |
|
|
* Which intonation tunes to use. |
|
|
* Rules for speaking numbers. |
|
|
* Rules for speaking numbers. |
|
|
|
|
|
|
|
|
The function SetTranslator() at the start of the source code file |
|
|
The function `SetTranslator()` at the start of the source code file |
|
|
tr\_languages.cpp recognizes the language code and sets the appropriate |
|
|
`tr_languages.c` recognizes the language code and sets the appropriate |
|
|
options. For a new language, you would add its language code and the |
|
|
options. For a new language, you would add its language code and the |
|
|
required options in SetTranslator(). However, this may not be necessary |
|
|
required options in `SetTranslator()`. However, this may not be necessary |
|
|
during testing because most of the options can also be set in the voice |
|
|
during testing because most of the options can also be set in the voice |
|
|
file in espeak-data/voices (see [Voice |
|
|
file in espeak-data/voices (see [Voice Files](voices.md)). |
|
|
files](voices.md)). |
|
|
|
|
|
|
|
|
|
|
|
## Improving a Language |
|
|
## Improving a Language |
|
|
|
|
|
|
|
|
Listen carefully to the eSpeak voice. Try to identify what sounds wrong |
|
|
Listen carefully to the eSpeak voice. Try to identify what sounds wrong |
|
|
and what needs to be improved. |
|
|
and what needs to be improved. |
|
|
|
|
|
|
|
|
|
|
|
* Make the spelling-to-phoneme translation rules more accurate, including |
|
|
* Make the spelling-to-phoneme translation rules more accurate, including the position of stressed syllables within words. Some languages are easier than others. I expect most are easier than English. |
|
|
the position of stressed syllables within words. Some languages are easier |
|
|
* 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, in a stressed or unstressed syllable, etc. This may consist of making small adjustments to vowel and diphthong quality or length, or adjusting the strength of consonants. Phoneme definitions can include conditional statements which can be used to change the sound of a phoneme depending on its environment. Bigger changes may be recording new or replacement consonant sounds, or may even need program code to implement new types of sounds. |
|
|
than others. I expect most are easier than English. |
|
|
* Some common words should be added to the dictionary (the fr_list file for the language) with an "unstressed" attribute **\$u** or **\$u+** (eg. in English, words such as "the", "is", "had", "my", "she", "of", "in", "some"), or should be preceded by a short pause (such as "and", "but", "which"), or have other attributes, in order to make the speech flow better. |
|
|
* Improve the sounds of the phonemes. It may be that a phoneme should sound |
|
|
* Improve the rhythm of the speech by adjusting the relative lengths of vowels in different contexts, eg. stressed/unstressed syllable, or depending on the following phonemes. This is important for making the speech sound good for the language. |
|
|
different depending on adjacent sounds, or whether it's at the start or the |
|
|
* Make new intonation "tunes" for statements or questions (see [Intonation](intonation.md)). |
|
|
end of a word, between vowels, in a stressed or unstressed syllable, etc. |
|
|
|
|
|
This may consist of making small adjustments to vowel and diphthong quality |
|
|
For most of the eSpeak voices, I do not speak or understand the |
|
|
or length, or adjusting the strength of consonants. Phoneme definitions can |
|
|
language, and I do not know how it should sound. I can only make |
|
|
include conditional statements which can be used to change the sound of a |
|
|
improvements as a result of feedback from speakers of that language. If |
|
|
phoneme depending on its environment. Bigger changes may be recording new or |
|
|
you want to help to improve a language, listen carefully and try to |
|
|
replacement consonant sounds, or may even need program code to implement new |
|
|
identify individual errors, either in the spelling-to-phoneme |
|
|
types of sounds. |
|
|
translation, the position of stressed syllables within words, or the |
|
|
* Some common words should be added to the dictionary (the `fr_list` file for |
|
|
sound of phonemes, or problems with rhythm and vowel lengths. |
|
|
the language) with an "unstressed" attribute `$u` or `$u+` (e.g. in English, |
|
|
|
|
|
words such as "the", "is", "had", "my", "she", "of", "in", "some"), or should |
|
|
|
|
|
be preceded by a short pause (such as "and", "but", "which"), or have other |
|
|
|
|
|
attributes, in order to make the speech flow better. |
|
|
|
|
|
|
|
|
|
|
|
* Improve the rhythm of the speech by adjusting the relative lengths of vowels |
|
|
|
|
|
in different contexts, e.g. stressed/unstressed syllable, or depending on the |
|
|
|
|
|
following phonemes. This is important for making the speech sound good for the |
|
|
|
|
|
language. |
|
|
|
|
|
|
|
|
|
|
|
* Make new intonation "tunes" for statements or questions (see |
|
|
|
|
|
[Intonation](intonation.md)). |
|
|
|
|
|
|
|
|
|
|
|
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. |