mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 05:35:35 +00:00
[1.29.20] Fix for crash in Chinese text.
git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@104 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
@@ -13,4 +13,4 @@ formant 4 97 102 100
|
||||
formant 5 97 102 100
|
||||
|
||||
stressAdd 10 10 0 0 0 0 -30 -30
|
||||
dictrules 2
|
||||
dictrules 3 4
|
||||
|
||||
@@ -15,3 +15,4 @@ formant 4 97 102 100
|
||||
formant 5 97 102 100
|
||||
|
||||
stressAdd 10 10 0 0 0 0 -30 -30
|
||||
dictrules 1
|
||||
|
||||
@@ -12,3 +12,4 @@ formant 4 97 102 100
|
||||
formant 5 97 102 100
|
||||
|
||||
stressAdd 10 10 0 0 0 0 -30 -30
|
||||
dictrules 2 4
|
||||
|
||||
@@ -1074,7 +1074,6 @@ vowel/@ [@] base
|
||||
[@] en_rp
|
||||
[V] cy
|
||||
[@4] hi
|
||||
[@] hr
|
||||
vowel/@- [@-] base
|
||||
[r*] hr
|
||||
vowel/& [a] en_rp
|
||||
@@ -1282,6 +1281,7 @@ vowel/@_fnt [@2] hr
|
||||
vowel/@_hgh [@] en_us
|
||||
[@2] en_us
|
||||
[@5] en_us
|
||||
[@] hr
|
||||
[@] no
|
||||
vowel/i [i] base2
|
||||
[i:] en_n
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
phoneme @ // Schwa
|
||||
vowel starttype (@) endtype (@)
|
||||
formants vowel/@
|
||||
formants vowel/@_hgh
|
||||
length 140
|
||||
endphoneme
|
||||
|
||||
|
||||
Binary file not shown.
+3
-2
@@ -203,6 +203,7 @@ int Translator::TranslateRoman(char *word, char *ph_out)
|
||||
{//=====================================================
|
||||
int c;
|
||||
char *p;
|
||||
const char *p2;
|
||||
int acc;
|
||||
int prev;
|
||||
int value;
|
||||
@@ -219,10 +220,10 @@ int Translator::TranslateRoman(char *word, char *ph_out)
|
||||
|
||||
while((c = *word++) != ' ')
|
||||
{
|
||||
if((p = strchr(roman_numbers,c)) == NULL)
|
||||
if((p2 = strchr(roman_numbers,c)) == NULL)
|
||||
return(0);
|
||||
|
||||
value = roman_values[p - roman_numbers];
|
||||
value = roman_values[p2 - roman_numbers];
|
||||
|
||||
if((prev==5) || (prev==50) || (prev==500))
|
||||
{
|
||||
|
||||
@@ -521,6 +521,7 @@ void MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, FILE *f_mbrola)
|
||||
#else
|
||||
// fprintf(f_mbrola,";; v=%.2f\n",(float)(mbrola_control & 0xff)/16.0); // ;; v= has no effect on mbrola
|
||||
#endif
|
||||
|
||||
for(phix=1; phix < n_phonemes; phix++)
|
||||
{
|
||||
mbr_buf[0] = 0;
|
||||
@@ -674,7 +675,7 @@ void MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, FILE *f_mbrola)
|
||||
#ifdef USE_MBROLA_LIB
|
||||
MbrolaSynth(NULL);
|
||||
#endif
|
||||
} // end of SynthMbrola
|
||||
} // end of MbrolaTranslate
|
||||
|
||||
|
||||
#ifdef TEST_MBROLA
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
#include "translate.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;
|
||||
|
||||
int option_device_number = -1;
|
||||
|
||||
+12
-4
@@ -371,6 +371,13 @@ int IsAlpha(unsigned int c)
|
||||
return(0);
|
||||
}
|
||||
|
||||
int IsDigit09(unsigned int c)
|
||||
{//=========================
|
||||
if((c >= 0) && (c <= 9))
|
||||
return(1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
int IsDigit(unsigned int c)
|
||||
{//========================
|
||||
if(iswdigit(c))
|
||||
@@ -1770,7 +1777,7 @@ void *Translator::TranslateClause(FILE *f_text, const void *vp_input, int *tone_
|
||||
prev_out2 = prev_out;
|
||||
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
|
||||
prev_out = 'a';
|
||||
@@ -1864,7 +1871,7 @@ void *Translator::TranslateClause(FILE *f_text, const void *vp_input, int *tone_
|
||||
// speak as words
|
||||
|
||||
#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
|
||||
word_mark = next_in-'0';
|
||||
@@ -1892,7 +1899,7 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && 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
|
||||
}
|
||||
@@ -2091,7 +2098,7 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
|
||||
else
|
||||
if(iswdigit(c))
|
||||
{
|
||||
if(langopts.tone_numbers && IsAlpha(prev_out) && !isdigit(next_in))
|
||||
if(langopts.tone_numbers && IsAlpha(prev_out) && !IsDigit(next_in))
|
||||
{
|
||||
}
|
||||
else
|
||||
@@ -2211,6 +2218,7 @@ if((c == '/') && (langopts.testing & 2) && isdigit(next_in) && IsAlpha(prev_out)
|
||||
continue;
|
||||
|
||||
|
||||
// digits should have been converted to Latin alphabet ('0' to '9')
|
||||
word = pw = &sbuf[words[ix].start];
|
||||
for(n_digits=0; iswdigit(word[n_digits]); n_digits++); // count consecutive digits
|
||||
if((n_digits > 4) && (word[0] != '0'))
|
||||
|
||||
+4
-6
@@ -1762,11 +1762,12 @@ void Write4Bytes(FILE *f, int value)
|
||||
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] = {
|
||||
'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,
|
||||
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)
|
||||
return(2);
|
||||
@@ -1783,7 +1784,7 @@ int OpenWaveFile(const char *path, int rate)
|
||||
fwrite(wave_hdr,1,24,f_wave);
|
||||
Write4Bytes(f_wave,rate);
|
||||
Write4Bytes(f_wave,rate * 2);
|
||||
fwrite(&wave_hdr[32],1,8,f_wave);
|
||||
fwrite(&wave_hdr[32],1,12,f_wave);
|
||||
return(0);
|
||||
}
|
||||
return(1);
|
||||
@@ -1862,8 +1863,6 @@ int WavegenFill(int fill_zeros)
|
||||
{
|
||||
if(WcmdqUsed() <= 0)
|
||||
{
|
||||
#define echo2
|
||||
#ifdef echo2
|
||||
if(echo_complete > 0)
|
||||
{
|
||||
// continue to play silence until echo is completed
|
||||
@@ -1871,7 +1870,6 @@ int WavegenFill(int fill_zeros)
|
||||
if(resume == 1)
|
||||
return(0); // not yet finished
|
||||
}
|
||||
#endif
|
||||
|
||||
if(fill_zeros)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user