精通
英语
和
开源
,
擅长
开发
与
培训
,
胸怀四海
第一信赖
服务方向
联系方式
因为朗读的原声是英文的,所以想把espeak朗读的效果改成中文味道,就想研究下espeak组织发音的方式,大概看了下英文介绍,发现是以拼音方式组织音素,并不是为每个汉字都准备wav信息,分析espeak文件时,文件都不大,不可能包含这么多汉字的wav信息。用拼音的话,espeak在组织元音辅音这类方式上还是很到位的,还提供了espeakedit工具来编辑。具体研究大家看下面的翻译。
6. ADDING OR IMPROVING A LANGUAGE 6.添加或改善语言
Most of the work doesn't need any programming knowledge. Just an understanding of the language, an awareness of its features, patience and attention to detail. Wikipedia is a good source of basic phonetic information, eg http://en.wikipedia.org/wiki/Vowel.
In many cases it should be fairly easy to add a rough implementation of a new language, hopefully enough to be intelligible. After that it's a gradual process of improvement. 大多数工作不需要任何编程知识。只需了解该语言,知晓特性,能耐心和对细节的关注。 Wikipedia是基本语音信息的良好来源,例如http://en.wikipedia.org/wiki/Vowel。在许多情况下,添加一种新语言的粗略实现应该很容易,希望做到尽可能好后。之后,这是一个逐步的改进过程。
6.1 Language Code 6.1语言代码
Generally, the language's international ISO 639-1 code is used to identify 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. Replace this with the code of your language. 通常,使用该语言的国际ISO 639-1代码来标识该语言。它用于包含语言数据的文件名中。在下面的示例中,以代码``fr''为例。用您的语言代码代替。
If the language does not have a 2-letter ISO_639-1 code, then use the 3-letter ISO_639-3 code. Language codes may differ from country codes. 如果该语言没有2个字母的ISO_639-1代码,请使用3个字母的ISO_639-3代码。语言代码可能与国家代码不同。
It is possible to have different variants of a language for different dialects. For example the sound of some phonemes are changed, or some of the pronunciation rules differ. 对于不同的方言,可能有不同的语言变体。例如,某些音素的声音已更改,或者某些发音规则有所不同。
6.2 Language Files 6.2语言文件
The following files are needed for your language. 您的语言需要以下文件。
The fr_rules and fr_list files are compiled to produce the file espeak-data/fr_dict, which eSpeak uses when it is speaking. fr_rules和fr_list文件被编译以生成文件epeak-data / fr_dict,eSpeak在讲话时会使用该文件。
6.3 Voice File 6.3语音文件
Each language needs a voice file in espeak-data/voices or 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). 每种语言都需要使用espeak-data / voices或espeak-data / voices / test中的语音文件。语言默认语音的文件名应与语言代码相同(例如,法语为“ fr”)。
Details of the contents of voice files are given in voices.html.
The simplest voice file would contain just 2 lines to give the language name and language code, eg: 语音文件内容的详细信息在voices.html中提供。
name french 最简单的语音文件将仅包含两行以提供语言名称和语言代码,例如:
language fr 法语名字
This language code specifies which phoneme table and dictionary to use (i.e. phonemetable fr and espeak-data/fr_dict) to be used. If needed, these can be overridden by phonemes and dictionary 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 existing language. 此语言代码指定要使用的音素表和字典(即,可语音识别的fr和 espeak-data/fr_dict)。如果需要,这些可以被语音文件中的音素和字典属性覆盖。例如,您可能想通过使用现有语言的音素表来开始新语言的实现。
6.4 Phoneme Definition File 6.4音素定义文件
You must first decide on the set of phonemes (vowel and consonant sounds) for the language. These should be defined in a phoneme 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 master phoneme file, phsource/phonemes, eg: 您必须首先确定该语言的音素集(元音和辅音)。这些应在音素定义文件ph_xxxx中定义,其中“ ph_xxxx”是您的语言名称。然后在主音素文件phsource / phonemes的末尾包含对该文件的引用,例如:
phonemetable fr base
include ph_french
This example defines a phoneme table "fr" which inherits the contents of phoneme table "base". Its contents are found in the file ph_french.
The base phoneme table contains definitions of a basic set of consonants, and also some "control" phonemes such as stress marks and pauses. These are defined in phsource/phonemes. The phoneme table 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. 此示例定义了一个音素表“ fr”,该表继承了音素表“ base”的内容。其内容可在文件ph_french中找到。基本音素表包含一组基本辅音的定义,以及一些“控制”音素,例如重音和停顿。这些在phsource /音素中定义。一种语言的音素表将继承这些音素表,或者可以继承另一种语言的音素表,而后者又继承基本的音素表。
The phonemes file for the language defines those additional phonemes which are not inherited (generally the vowels and diphthongs, plus any additional consonants that are needed), or phonemes whose definitions differ from the inherited version (eg. the redefinition of a consonant). 该语言的音素文件定义了那些未被继承的其他音素(通常是元音和双音,加上所需的任何其他辅音),或者其定义与继承版本不同的音素(例如重定义辅音)
Details of phonemes files are given in phontab.html.音素文件的详细信息在phontab.html中提供。
The Compile phoneme data function of the espeakedit program compiles the phonemes files of all languages to produce the files espeak-data/phontab, phonindex, and phondata which are used by eSpeak. 。
For many languages, the consonant phonemes which are already available in eSpeak, together with the available vowel files which can be used to define vowel phonemes, will be sufficient. At least for an initial implementation.
espeakedit程序的 “编译音素数据”功能会编译所有语言的音素文件,以生成eSpeak使用的文件espeak-data/phontab,phonindex和phondata。
对于许多语言而言,eSpeak中已经可用的辅音音素以及可用于定义元音音素的可用元音文件就足够了。至少对于最初的实现。
6.5 Dictionary Files 6.5字典文件
Once the language's phonemes have been defined, then pronunciation dictionary data can be produced in order to translate the language's source text into phonemes. This consists of two source files: fr_rules (the spelling to phoneme rules) and fr_list (an exceptions list, and attributes of certain words). The corresponding compiled data file is espeak-data/fr_dict which is produced from fr_rules and fr_list sources by the command: 一旦定义了语言的音素,便可以生成发音词典数据,以便将语言的源文本转换为音素。它由两个源文件组成:fr_rules(拼写为音素规则)和fr_list(例外列表以及某些单词的属性)。相应的已编译数据文件为espeak-data / fr_dict,该文件是通过以下命令从fr_rules和fr_list来源生成的:
espeak --compile=fr
Or by using the espeakedit program. 或使用espeakedit程序。
Details of the contents of the dictionary files are given in dictionary.html.字典文件内容的详细信息在dictionary.html中给出。
The fr_list file contains:
该fr_list文件包含:
6.6 Program Code 6.6程式码
The behaviour of the eSpeak program is controlled by various options such as: eSpeak程序的行为由各种选项控制,例如:
The function SetTranslator() at the start of the source code file tr_languages.cpp recognizes the language code and sets the appropriate options. For a new language, you would add its language code and the required options in SetTranslator(). However, this may not be necessary during testing because most of the options can also be set in the voice file in espeak-data/voices (see Voice files).
源代码文件tr_languages.cpp开头的函数SetTranslator()识别语言代码并设置适当的选项。对于新语言,您可以在SetTranslator()中添加其语言代码和必需的选项。但是,这在测试期间可能不是必需的,因为大多数选项也可以在espeak-data / voices的语音文件中设置
6.7 Improving a Language 6.7改善语言
Listen carefully to the eSpeak voice. Try to identify what sounds wrong and what needs to be improved. 仔细听eSpeak语音。尝试找出听起来错误的地方以及需要改进的地方。
If you are interested in working on a language, please contact me so that I can set up the initial data and discuss the features of the language. 如果您对使用某种语言感兴趣,请与我联系,以便我设置初始数据并讨论该语言的功能。
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. 对于大多数eSpeak语音,我不会说或不理解该语言,也不知道该如何发音。我只能根据使用该语言的人的反馈进行改进。如果要帮助提高语言水平,请仔细听并尝试找出单个错误,包括拼写到音素的翻译,单词中重读音节的位置,音素的声音或韵律和元音长度的问题。