git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@104 d46cf337-b52f-0410-862d-fd96e6ae7743master
formant 5 97 102 100 | formant 5 97 102 100 | ||||
stressAdd 10 10 0 0 0 0 -30 -30 | stressAdd 10 10 0 0 0 0 -30 -30 | ||||
dictrules 2 | |||||
dictrules 3 4 |
formant 5 97 102 100 | formant 5 97 102 100 | ||||
stressAdd 10 10 0 0 0 0 -30 -30 | stressAdd 10 10 0 0 0 0 -30 -30 | ||||
dictrules 1 |
formant 5 97 102 100 | formant 5 97 102 100 | ||||
stressAdd 10 10 0 0 0 0 -30 -30 | stressAdd 10 10 0 0 0 0 -30 -30 | ||||
dictrules 2 4 |
[@] en_rp | [@] en_rp | ||||
[V] cy | [V] cy | ||||
[@4] hi | [@4] hi | ||||
[@] hr | |||||
vowel/@- [@-] base | vowel/@- [@-] base | ||||
[r*] hr | [r*] hr | ||||
vowel/& [a] en_rp | vowel/& [a] en_rp | ||||
vowel/@_hgh [@] en_us | vowel/@_hgh [@] en_us | ||||
[@2] en_us | [@2] en_us | ||||
[@5] en_us | [@5] en_us | ||||
[@] hr | |||||
[@] no | [@] no | ||||
vowel/i [i] base2 | vowel/i [i] base2 | ||||
[i:] en_n | [i:] en_n |
phoneme @ // Schwa | phoneme @ // Schwa | ||||
vowel starttype (@) endtype (@) | vowel starttype (@) endtype (@) | ||||
formants vowel/@ | |||||
formants vowel/@_hgh | |||||
length 140 | length 140 | ||||
endphoneme | endphoneme | ||||
{//===================================================== | {//===================================================== | ||||
int c; | int c; | ||||
char *p; | char *p; | ||||
const char *p2; | |||||
int acc; | int acc; | ||||
int prev; | int prev; | ||||
int value; | int value; | ||||
while((c = *word++) != ' ') | while((c = *word++) != ' ') | ||||
{ | { | ||||
if((p = strchr(roman_numbers,c)) == NULL) | |||||
if((p2 = strchr(roman_numbers,c)) == NULL) | |||||
return(0); | return(0); | ||||
value = roman_values[p - roman_numbers]; | |||||
value = roman_values[p2 - roman_numbers]; | |||||
if((prev==5) || (prev==50) || (prev==500)) | if((prev==5) || (prev==50) || (prev==500)) | ||||
{ | { |
#else | #else | ||||
// fprintf(f_mbrola,";; v=%.2f\n",(float)(mbrola_control & 0xff)/16.0); // ;; v= has no effect on mbrola | // fprintf(f_mbrola,";; v=%.2f\n",(float)(mbrola_control & 0xff)/16.0); // ;; v= has no effect on mbrola | ||||
#endif | #endif | ||||
for(phix=1; phix < n_phonemes; phix++) | for(phix=1; phix < n_phonemes; phix++) | ||||
{ | { | ||||
mbr_buf[0] = 0; | mbr_buf[0] = 0; | ||||
#ifdef USE_MBROLA_LIB | #ifdef USE_MBROLA_LIB | ||||
MbrolaSynth(NULL); | MbrolaSynth(NULL); | ||||
#endif | #endif | ||||
} // end of SynthMbrola | |||||
} // end of MbrolaTranslate | |||||
#ifdef TEST_MBROLA | #ifdef TEST_MBROLA |
#include "translate.h" | #include "translate.h" | ||||
#include "wave.h" | #include "wave.h" | ||||
const char *version_string = "1.29.18 10.Nov.07"; | |||||
const char *version_string = "1.29.20 13.Nov.07"; | |||||
const int version_phdata = 0x012901; | const int version_phdata = 0x012901; | ||||
int option_device_number = -1; | int option_device_number = -1; |
return(0); | return(0); | ||||
} | } | ||||
int IsDigit09(unsigned int c) | |||||
{//========================= | |||||
if((c >= 0) && (c <= 9)) | |||||
return(1); | |||||
return(0); | |||||
} | |||||
int IsDigit(unsigned int c) | int IsDigit(unsigned int c) | ||||
{//======================== | {//======================== | ||||
if(iswdigit(c)) | if(iswdigit(c)) | ||||
prev_out2 = prev_out; | prev_out2 = prev_out; | ||||
utf8_in(&prev_out,&sbuf[ix-1],1); // prev_out = sbuf[ix-1]; | utf8_in(&prev_out,&sbuf[ix-1],1); // prev_out = sbuf[ix-1]; | ||||
if(langopts.tone_numbers && isdigit(prev_out) && IsAlpha(prev_out2)) | |||||
if(langopts.tone_numbers && IsDigit09(prev_out) && IsAlpha(prev_out2)) | |||||
{ | { | ||||
// tone numbers can be part of a word, consider them as alphabetic | // tone numbers can be part of a word, consider them as alphabetic | ||||
prev_out = 'a'; | prev_out = 'a'; | ||||
// speak as words | // speak as words | ||||
#ifdef deleted | #ifdef deleted | ||||
if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)) | |||||
if((c == '/') && (langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(prev_out)) | |||||
{ | { | ||||
// TESTING, explicit indication of stressed syllable by /2 after the word | // TESTING, explicit indication of stressed syllable by /2 after the word | ||||
word_mark = next_in-'0'; | word_mark = next_in-'0'; | ||||
{ | { | ||||
if(IsAlpha(prev_out)) | if(IsAlpha(prev_out)) | ||||
{ | { | ||||
if(langopts.tone_numbers && isdigit(c) && !isdigit(next_in)) | |||||
if(langopts.tone_numbers && IsDigit09(c) && !IsDigit09(next_in)) | |||||
{ | { | ||||
// allow a tone number as part of the word | // allow a tone number as part of the word | ||||
} | } | ||||
else | else | ||||
if(iswdigit(c)) | if(iswdigit(c)) | ||||
{ | { | ||||
if(langopts.tone_numbers && IsAlpha(prev_out) && !isdigit(next_in)) | |||||
if(langopts.tone_numbers && IsAlpha(prev_out) && !IsDigit(next_in)) | |||||
{ | { | ||||
} | } | ||||
else | else | ||||
continue; | continue; | ||||
// digits should have been converted to Latin alphabet ('0' to '9') | |||||
word = pw = &sbuf[words[ix].start]; | word = pw = &sbuf[words[ix].start]; | ||||
for(n_digits=0; iswdigit(word[n_digits]); n_digits++); // count consecutive digits | for(n_digits=0; iswdigit(word[n_digits]); n_digits++); // count consecutive digits | ||||
if((n_digits > 4) && (word[0] != '0')) | if((n_digits > 4) && (word[0] != '0')) |
int OpenWaveFile(const char *path, int rate) | int OpenWaveFile(const char *path, int rate) | ||||
/******************************************/ | /******************************************/ | ||||
{ | { | ||||
// Set the length of 0x7fffffff for --stdout | |||||
// This will be changed to the correct length for -w (write to file) | |||||
static unsigned char wave_hdr[44] = { | static unsigned char wave_hdr[44] = { | ||||
'R','I','F','F',0,0,0,0,'W','A','V','E','f','m','t',' ', | 'R','I','F','F',0,0,0,0,'W','A','V','E','f','m','t',' ', | ||||
0x10,0,0,0,1,0,1,0, 9,0x3d,0,0,0x12,0x7a,0,0, | 0x10,0,0,0,1,0,1,0, 9,0x3d,0,0,0x12,0x7a,0,0, | ||||
2,0,0x10,0,'d','a','t','a', 0,0,0,0 }; | |||||
2,0,0x10,0,'d','a','t','a', 0xff,0xff,0xff,0x7f}; | |||||
if(path == NULL) | if(path == NULL) | ||||
return(2); | return(2); | ||||
fwrite(wave_hdr,1,24,f_wave); | fwrite(wave_hdr,1,24,f_wave); | ||||
Write4Bytes(f_wave,rate); | Write4Bytes(f_wave,rate); | ||||
Write4Bytes(f_wave,rate * 2); | Write4Bytes(f_wave,rate * 2); | ||||
fwrite(&wave_hdr[32],1,8,f_wave); | |||||
fwrite(&wave_hdr[32],1,12,f_wave); | |||||
return(0); | return(0); | ||||
} | } | ||||
return(1); | return(1); | ||||
{ | { | ||||
if(WcmdqUsed() <= 0) | if(WcmdqUsed() <= 0) | ||||
{ | { | ||||
#define echo2 | |||||
#ifdef echo2 | |||||
if(echo_complete > 0) | if(echo_complete > 0) | ||||
{ | { | ||||
// continue to play silence until echo is completed | // continue to play silence until echo is completed | ||||
if(resume == 1) | if(resume == 1) | ||||
return(0); // not yet finished | return(0); // not yet finished | ||||
} | } | ||||
#endif | |||||
if(fill_zeros) | if(fill_zeros) | ||||
{ | { |