Added ResetLetterBits() to clear data before using SetLetterBits(). git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@19 d46cf337-b52f-0410-862d-fd96e6ae7743master
b c d f g h j k | b c d f g h j k | ||||
l m n N p r s t | l m n N p r s t | ||||
tS v w z | tS v w z | ||||
Dictionary is_dict | |||||
& @- a aI aU e E eI | |||||
i I o O oU u W y | |||||
Yy | |||||
* : ; b c C d D | |||||
f g h j J k l L | |||||
l# m m# n N n# N# n^ | |||||
n^# p Q r r# s S t | |||||
T tl# v x z |
// Α α, Β β, Γ γ, Δ δ, Ε ε, Ζ ζ, Η η, Θ θ, Ι ι, Κ κ, Λ λ, Μ μ, Ν ν, Ξ ξ, | // Α α, Β β, Γ γ, Δ δ, Ε ε, Ζ ζ, Η η, Θ θ, Ι ι, Κ κ, Λ λ, Μ μ, Ν ν, Ξ ξ, | ||||
// Ο ο, Π π, Ρ ρ, Σ σ ς (word-final form), Τ τ, Υ υ, Φ φ, Χ χ, Ψ ψ, Ω ω. | // Ο ο, Π π, Ρ ρ, Σ σ ς (word-final form), Τ τ, Υ υ, Φ φ, Χ χ, Ψ ψ, Ω ω. | ||||
// Y: ε η ι υ (+tonos variants, front vowels). | |||||
// Letter group B: θ κ ξ π ς σ τ φ χ (voiceless consonants) | |||||
// Letter group Y: ε η ι υ έ ή ί ύ (front vowels). | |||||
.group α | .group α | ||||
δ D | δ D | ||||
δ (δ | δ (δ | ||||
.group ε | .group ε | ||||
ε e | ε e | ||||
ει i | ει i |
el 8 112 | el 8 112 | ||||
sv 25 114 | sv 25 114 | ||||
no 29 118 | no 29 118 | ||||
is 27 113 | |||||
is 32 117 | |||||
vi 41 129 | vi 41 129 | ||||
zh_yue 32 120 | zh_yue 32 120 | ||||
sw 14 101 | sw 14 101 | ||||
1 n^/_n^ base | 1 n^/_n^ base | ||||
1 n^/n^_ base | 1 n^/n^_ base | ||||
1 n^/n^@ base | 1 n^/n^@ base | ||||
1 n^/n^#_ is | |||||
6 n/_n base ro | 6 n/_n base ro | ||||
3 n/n_ base ro | 3 n/n_ base ro | ||||
1 n/n@ base | 1 n/n@ base | ||||
1 ufric/sx_sv sv | 1 ufric/sx_sv sv | ||||
1 ufric/th base | 1 ufric/th base | ||||
1 ufric/th_ base | 1 ufric/th_ base | ||||
1 ufric/tl# is | |||||
2 ufric/x base vi | 2 ufric/x base vi | ||||
4 ufric/x2 af nl pt | 4 ufric/x2 af nl pt | ||||
1 ufric/x_hr hr | 1 ufric/x_hr hr | ||||
1 ustop/c base | 1 ustop/c base | ||||
5 ustop/k base en fr hi sw | 5 ustop/k base en fr hi sw | ||||
9 ustop/k_ base en fi fr hi hu it el sw | 9 ustop/k_ base en fi fr hi hu it el sw | ||||
11 ustop/ki base en af fi fr hi hu it sw | |||||
12 ustop/ki base en af fi fr hi hu it is sw | |||||
10 ustop/kl base en fi fr hi hu it el sw | 10 ustop/kl base en fi fr hi hu it el sw | ||||
11 ustop/kr base en fi fr hi hu it el sw | 11 ustop/kr base en fi fr hi hu it el sw | ||||
9 ustop/k_unasp base fi hi hu it el | 9 ustop/k_unasp base fi hi hu it el | ||||
2 vdiph/ooi_3 en_wm hr | 2 vdiph/ooi_3 en_wm hr | ||||
2 vdiph/ou fi zh_yue | 2 vdiph/ou fi zh_yue | ||||
2 vdiph/ou_2 sk ro | 2 vdiph/ou_2 sk ro | ||||
1 vdiph/ou_3 is | |||||
2 vdiph/ou_3 is | |||||
1 vdiph/@u en_wm | 1 vdiph/@u en_wm | ||||
1 vdiph/@u_2 en_rp | 1 vdiph/@u_2 en_rp | ||||
1 vdiph/@u_3 ro | 1 vdiph/@u_3 ro | ||||
2 voc/Q base | 2 voc/Q base | ||||
4 voc/Q_ base nl pt | 4 voc/Q_ base nl pt | ||||
2 voc/Q_less nl pt | 2 voc/Q_less nl pt | ||||
5 voc/v base fi hi nl ro | |||||
6 voc/v_ base fi hi nl ro | |||||
6 voc/v base fi hi nl ro is | |||||
7 voc/v_ base fi hi nl ro is | |||||
4 vocw/dh base es | 4 vocw/dh base es | ||||
2 vocw/Q base | 2 vocw/Q base | ||||
3 vocw/Q_ base nl | 3 vocw/Q_ base nl | ||||
20 x/b base hi ro is | 20 x/b base hi ro is | ||||
2 x/b_ base is | 2 x/b_ base is | ||||
9 x/d base hi hr el is | 9 x/d base hi hr el is | ||||
15 x/d_ base fi fr hi hu pl hr ru it ro el is ++ | |||||
22 x/d_dnt base fi fr hi hu pl ru it ro sw | |||||
14 x/d_ base fi fr hi pl hr ru it ro el is sw | |||||
23 x/d_dnt base fi fr hi hu pl ru it ro sw | |||||
6 x/d_pzd pl ru | 6 x/d_pzd pl ru | ||||
3 x/dzh base hi | 3 x/dzh base hi | ||||
5 x/dzh_ base hi ru | 5 x/dzh_ base hi ru |
vowelin f1=2 f2=1500 -300 300 f3=-150 80 | vowelin f1=2 f2=1500 -300 300 f3=-150 80 | ||||
vowelout f1=2 f2=1500 -300 300 f3=-150 80 | vowelout f1=2 f2=1500 -300 300 f3=-150 80 | ||||
formants d/d+x/d_dnt%110 | formants d/d+x/d_dnt%110 | ||||
before _ d/d_+x/d_ | |||||
before _ d/d_+x/d_dnt%80 | |||||
before r d/dr+x/d_dnt%110 | before r d/dr+x/d_dnt%110 | ||||
after _ NULL | after _ NULL | ||||
after @ d/xd | after @ d/xd |
tr->letter_bits[c] = 0x81; // group 0 only | tr->letter_bits[c] = 0x81; // group 0 only | ||||
} | } | ||||
void ResetLetterBits(Translator *tr, int groups) | |||||
{//============================================= | |||||
// Clear all the specified groups | |||||
unsigned int ix; | |||||
unsigned int mask; | |||||
mask = ~groups; | |||||
for(ix=0; ix<sizeof(tr->letter_bits); ix++) | |||||
{ | |||||
tr->letter_bits[ix] &= mask; | |||||
} | |||||
} | |||||
void SetLetterBits(Translator *tr, int group, const char *string) | void SetLetterBits(Translator *tr, int group, const char *string) | ||||
{//============================================================== | {//============================================================== | ||||
int bits; | int bits; |
unsigned int ix=0; | unsigned int ix=0; | ||||
char textbuf[2000]; | char textbuf[2000]; | ||||
espeak_VOICE voice; | espeak_VOICE voice; | ||||
espeak_VOICE *voice2; | |||||
//FindPhonemesUsed(); | //FindPhonemesUsed(); | ||||
//return; | //return; | ||||
voice.gender = 0; | voice.gender = 0; | ||||
voice.age = 0; | voice.age = 0; | ||||
voice.variant = 0; | voice.variant = 0; | ||||
espeak_SetVoiceByName("en"); | |||||
ix = espeak_SetVoiceByName("pt-xx"); | |||||
voice2 = espeak_GetCurrentVoice(); | |||||
// espeak_SetVoiceByProperties(&voice); | // espeak_SetVoiceByProperties(&voice); | ||||
espeak_SetParameter(espeakRANGE,0,0); | espeak_SetParameter(espeakRANGE,0,0); | ||||
espeak_Synth(textbuf,ix+1,0,POS_CHARACTER,0,espeakCHARS_8BIT+espeakSSML,NULL,NULL); | espeak_Synth(textbuf,ix+1,0,POS_CHARACTER,0,espeakCHARS_8BIT+espeakSSML,NULL,NULL); |
#include "translate.h" | #include "translate.h" | ||||
#include "wave.h" | #include "wave.h" | ||||
const char *version_string = "1.25.02 21.May.07"; | |||||
const char *version_string = "1.25.03 22.May.07"; | |||||
const int version_phdata = 0x012501; | const int version_phdata = 0x012501; | ||||
int option_device_number = -1; | int option_device_number = -1; |
modified = 0; | modified = 0; | ||||
if(frame->frflags & FRFLAG_FORMANT_RATE) | if(frame->frflags & FRFLAG_FORMANT_RATE) | ||||
len = (len * 13)/10; // allow slightly greater rate of change for this frame (was 12/10) | |||||
len = (len * 12)/10; // allow slightly greater rate of change for this frame (was 12/10) | |||||
for(pk=0; pk<6; pk++) | for(pk=0; pk<6; pk++) | ||||
{ | { |
// character codes offset by 0x380 | // character codes offset by 0x380 | ||||
static const char el_vowels[] = {0x10,0x2c,0x2d,0x2e,0x2f,0x30,0x31,0x35,0x37,0x39,0x3f,0x45,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0}; | static const char el_vowels[] = {0x10,0x2c,0x2d,0x2e,0x2f,0x30,0x31,0x35,0x37,0x39,0x3f,0x45,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0}; | ||||
static const char el_fvowels[] = {0x2d,0x2e,0x2f,0x35,0x37,0x39,0x45,0x4d,0}; | |||||
static const char el_voiceless[]= {0x38,0x3a,0x3f,0x40,0x42,0x43,0x44,0x46,0x47,0}; | |||||
static const char el_fvowels[] = {0x2d,0x2e,0x2f,0x35,0x37,0x39,0x45,0x4d,0}; // ε η ι υ έ ή ί ύ | |||||
static const char el_voiceless[]= {0x38,0x3a,0x3e,0x40,0x42,0x43,0x44,0x46,0x47,0}; // θ κ ξ π ς σ τ φ χ | |||||
static const char el_consonants[]={0x32,0x33,0x34,0x36,0x38,0x3a,0x3b,0x3c,0x3d,0x3e,0x40,0x41,0x42,0x43,0x44,0x46,0x47,0x48,0}; | static const char el_consonants[]={0x32,0x33,0x34,0x36,0x38,0x3a,0x3b,0x3c,0x3d,0x3e,0x40,0x41,0x42,0x43,0x44,0x46,0x47,0x48,0}; | ||||
static const wchar_t el_char_apostrophe[] = {0x3c3,0}; // σ | static const wchar_t el_char_apostrophe[] = {0x3c3,0}; // σ | ||||
tr->letter_bits_offset = OFFSET_DEVANAGARI; | tr->letter_bits_offset = OFFSET_DEVANAGARI; | ||||
tr->langopts.replace_chars = replace_chars_hi; | tr->langopts.replace_chars = replace_chars_hi; | ||||
tr->langopts.replacement_chars = replacement_chars_hi; | tr->langopts.replacement_chars = replacement_chars_hi; | ||||
memset(tr->letter_bits,0,sizeof(tr->letter_bits)); | |||||
SetLetterBitsRange(tr,LETTERGP_A,0x06,0x14); // vowel letters | SetLetterBitsRange(tr,LETTERGP_A,0x06,0x14); // vowel letters | ||||
SetLetterBitsRange(tr,LETTERGP_B,0x3e,0x4d); // vowel signs + virama | SetLetterBitsRange(tr,LETTERGP_B,0x3e,0x4d); // vowel signs + virama | ||||
SetLetterBitsRange(tr,LETTERGP_C,0x15,0x39); // the main consonant range | SetLetterBitsRange(tr,LETTERGP_C,0x15,0x39); // the main consonant range | ||||
case L('h','u'): // Hungarian | case L('h','u'): // Hungarian | ||||
{ | { | ||||
static int stress_amps_hu[8] = {16,16, 20,20, 20,24, 24,22 }; | static int stress_amps_hu[8] = {16,16, 20,20, 20,24, 24,22 }; | ||||
static int stress_lengths_hu[8] = {180,150, 200,180, 0,0, 230,270}; | |||||
static int stress_lengths_hu[8] = {180,160, 200,180, 0,0, 230,270}; | |||||
static const wchar_t replace_chars_hu[] = {0xd4,0xf4,0xdb,0xfb,0}; | static const wchar_t replace_chars_hu[] = {0xd4,0xf4,0xdb,0xfb,0}; | ||||
static const unsigned int replacement_chars_hu[] = {0x150,0x151,0x170,0x171,0}; // allow o,u-circumflex for o,u-double-acute | static const unsigned int replacement_chars_hu[] = {0x150,0x151,0x170,0x171,0}; // allow o,u-circumflex for o,u-double-acute | ||||
tr->langopts.replacement_chars = replacement_chars_hu; | tr->langopts.replacement_chars = replacement_chars_hu; | ||||
tr->langopts.stress_rule = 0; | tr->langopts.stress_rule = 0; | ||||
tr->langopts.stress_flags = 0x56; // move secondary stress from light to a following heavy syllable | |||||
tr->langopts.stress_flags = 0x16; // move secondary stress from light to a following heavy syllable | |||||
tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x1; | tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x1; | ||||
tr->langopts.param[LOPT_IT_DOUBLING] = 1; | tr->langopts.param[LOPT_IT_DOUBLING] = 1; | ||||
tr->langopts.long_stop = 130; | tr->langopts.long_stop = 130; | ||||
case L('i','s'): // Icelandic | case L('i','s'): // Icelandic | ||||
{ | { | ||||
static int stress_amps_is[] = {16,16, 20,20, 20,24, 24,22 }; | static int stress_amps_is[] = {16,16, 20,20, 20,24, 24,22 }; | ||||
static int stress_lengths_is[8] = {180,140, 200,200, 0,0, 240,260}; | |||||
static const wchar_t is_L08[] = {'c','f','h','k','p','s','t','x',0xfe,0}; // voiceless conants, including 'þ' | |||||
static int stress_lengths_is[8] = {180,160, 200,200, 0,0, 240,260}; | |||||
static const wchar_t is_L08[] = {'c','f','h','k','p','t','x',0xfe,0}; // voiceless conants, including 'þ' ?? 's' | |||||
tr = new Translator(); | tr = new Translator(); | ||||
SetupTranslator(tr,stress_lengths_is,stress_amps_is); | SetupTranslator(tr,stress_lengths_is,stress_amps_is); | ||||
tr->langopts.stress_rule = 1; | tr->langopts.stress_rule = 1; | ||||
tr->langopts.param[LOPT_IT_LENGTHEN] = 0x11; // remove lengthen indicator from unstressed vowels | tr->langopts.param[LOPT_IT_LENGTHEN] = 0x11; // remove lengthen indicator from unstressed vowels | ||||
ResetLetterBits(tr,0x18); | |||||
SetLetterBits(tr,4,"kpst"); // Letter group F | SetLetterBits(tr,4,"kpst"); // Letter group F | ||||
SetLetterBits(tr,3,"jvr"); // Letter group H | SetLetterBits(tr,3,"jvr"); // Letter group H | ||||
tr->letter_groups[8] = is_L08; | tr->letter_groups[8] = is_L08; | ||||
SetLetterVowel(tr,'y'); | SetLetterVowel(tr,'y'); | ||||
SetLetterVowel(tr,'r'); | SetLetterVowel(tr,'r'); | ||||
ResetLetterBits(tr,0x2); | |||||
SetLetterBits(tr,5,sk_voiced); | SetLetterBits(tr,5,sk_voiced); | ||||
} | } | ||||
break; | break; |
int Eof(void); | int Eof(void); | ||||
char *strchr_w(const char *s, int c); | char *strchr_w(const char *s, int c); | ||||
int IsBracket(int c); | int IsBracket(int c); | ||||
void ResetLetterBits(Translator *tr, int groups); | |||||
void SetLetterBits(Translator *tr, int group, const char *string); | void SetLetterBits(Translator *tr, int group, const char *string); | ||||
void SetLetterBitsRange(Translator *tr, int group, int first, int last); | void SetLetterBitsRange(Translator *tr, int group, int first, int last); | ||||
void SetLetterVowel(Translator *tr, int c); | void SetLetterVowel(Translator *tr, int c); |
} | } | ||||
// first check for a voice with this filename | // first check for a voice with this filename | ||||
if(LoadVoice(buf,1) != NULL) | |||||
if((first_voice == NULL) && (LoadVoice(buf,1) != NULL)) | |||||
{ | { | ||||
voice_selected = first_voice; | voice_selected = first_voice; | ||||