[1.25.08] Fix to uft-8 recognizer.

lang=hu, set no secondary stress; [e:] [E] are closer, 
Don't consider mbrola voices during voice selection.
Fix voice variant not being set from SSML.


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@23 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2007-05-25 09:58:46 +00:00
parent 20d045d44c
commit 863f1f1048
17 changed files with 118 additions and 104 deletions
+4 -1
View File
@@ -156,7 +156,10 @@ extern void VoiceReset(int control);
// to something other than the default "C". Then, not only Latin1 but also the
// other characters give the correct results with iswalpha() etc.
if(setlocale(LC_CTYPE,"en_US.UTF-8") == NULL)
setlocale(LC_CTYPE,"");
{
if(setlocale(LC_CTYPE,"UTF-8") == NULL)
setlocale(LC_CTYPE,"");
}
// Create the main frame window
+15 -23
View File
@@ -858,12 +858,6 @@ void CharsetToUnicode(const char *charset)
char* text[]=
{
"<voice xml:lang=\"en\" variant=\"1\">eSpeak.</voice>",
" <voice xml:lang=\"en\" gender=\"male\" variant=\"1\"><prosody rate=\"1.0\"> normally would, </prosody></voice>"
};
#ifdef deleted
void Test2()
@@ -908,6 +902,11 @@ int x;
}
#endif
char* text1[]=
{
"<voice xml:lang=\"en\" variant=\"2\">eSpeak.</voice>",
" <voice xml:lang=\"fr\" gender=\"male\" variant=\"3\"><prosody rate=\"1.0\"> normally would, </prosody></voice>"
};
void TestTest(int control)
{//=======================
@@ -924,7 +923,7 @@ void TestTest(int control)
//CharsetToUnicode("ISCII");
return;
//return;
if(control==2)
{
@@ -951,25 +950,18 @@ if(control==2)
espeak_Initialize(AUDIO_OUTPUT_SYNCHRONOUS,100,NULL);
espeak_SetSynthCallback(TestSynthCallback);
// espeak_SetUriCallback(TestUriCallback);
voice.languages = "fr";
voice.gender = 0;
voice.age = 0;
voice.variant = 0;
ix = espeak_SetVoiceByName("pt-xx");
unsigned int unique_identifier=0;
int index=0;
espeak_Synth(text1[index], strlen(text1[index])+1, 0, POS_CHARACTER, 0, espeakSSML|espeakCHARS_UTF8, &unique_identifier, NULL);
voice2 = espeak_GetCurrentVoice();
espeak_SetParameter(espeakPUNCTUATION, 1, 0);
espeak_Synchronize();
// espeak_Cancel();
espeak_SetParameter(espeakPUNCTUATION, 1, 0);
// espeak_SetVoiceByProperties(&voice);
espeak_SetParameter(espeakRANGE,0,0);
espeak_Synth(textbuf,ix+1,0,POS_CHARACTER,0,espeakCHARS_8BIT+espeakSSML,NULL,NULL);
// for(voice.variant = 1; voice.variant < 9; voice.variant++)
// {
// espeak_SetVoiceByProperties(&voice);
// espeak_Synth(textbuf,ix+1,0,POS_CHARACTER,0,espeakCHARS_8BIT+espeakSSML,NULL,NULL);
// }
index++;
espeak_Synth(text1[index], strlen(text1[index])+1, 0, POS_CHARACTER, 0, espeakSSML|espeakCHARS_UTF8, &unique_identifier, NULL);
}
+2 -2
View File
@@ -286,7 +286,7 @@ static int GetC(void)
break;
}
if(((c2 & 0xc0) != 0x80) && ((c2 & m) != 0))
if((c2 & 0xc0) != 0x80)
{
GetC_unget(c2);
break;
@@ -963,7 +963,7 @@ static int GetVoiceAttributes(wchar_t *pw, int tag_type)
return(0); // <s> or <p> without language spec, nothing to do
ssml_sp = &ssml_stack[n_ssml_stack++];
attrcopy_utf8(ssml_sp->language,lang,sizeof(ssml_sp->language));
attrcopy_utf8(ssml_sp->voice_name,name,sizeof(ssml_sp->voice_name));
ssml_sp->voice_variant = attrnumber(variant,1,0)-1;
+4 -1
View File
@@ -259,7 +259,10 @@ static int initialise(void)
setlocale(LC_CTYPE,"ISO8859-1");
#else
if(setlocale(LC_CTYPE,"en_US.UTF-8") == NULL)
setlocale(LC_CTYPE,"");
{
if(setlocale(LC_CTYPE,"UTF-8") == NULL)
setlocale(LC_CTYPE,"");
}
#endif
+6 -3
View File
@@ -641,10 +641,13 @@ ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output_type, int buf_length
// to something other than the default "C". Then, not only Latin1 but also the
// other characters give the correct results with iswalpha() etc.
#ifdef PLATFORM_RISCOS
setlocale(LC_CTYPE,"ISO8859-1");
setlocale(LC_CTYPE,"ISO8859-1");
#else
if(setlocale(LC_CTYPE,"en_US.UTF-8") == NULL)
setlocale(LC_CTYPE,"");
if(setlocale(LC_CTYPE,"en_US.UTF-8") == NULL)
{
if(setlocale(LC_CTYPE,"UTF-8") == NULL)
setlocale(LC_CTYPE,"");
}
#endif
init_path(path);
+1 -1
View File
@@ -35,7 +35,7 @@
#include "translate.h"
#include "wave.h"
const char *version_string = "1.25.06 23.May.07";
const char *version_string = "1.25.08 25.May.07";
const int version_phdata = 0x012501;
int option_device_number = -1;
+2 -1
View File
@@ -325,7 +325,8 @@ Translator *SelectTranslator(const char *name)
tr->langopts.vowel_pause = 0x10;
tr->langopts.stress_rule = 0;
tr->langopts.stress_flags = 0x16;
tr->langopts.stress_flags = 0x36;
tr->langopts.unstressed_wd1 = 2;
tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x4; // don't propagate over word boundaries
tr->langopts.param[LOPT_IT_DOUBLING] = 1;
tr->langopts.long_stop = 130;
+11 -6
View File
@@ -874,7 +874,7 @@ voice_t *LoadVoiceVariant(const char *vname, int variant)
if((v != NULL) && (variant > 0))
{
sprintf(buf,"!variant%d",variant);
LoadVoice(buf,2);
v = LoadVoice(buf,2);
}
return(v);
}
@@ -1038,8 +1038,9 @@ static int ScoreVoice(espeak_VOICE *voice_spec, int spec_n_parts, int spec_lang_
} // end of ScoreVoice
static int SetVoiceScores(espeak_VOICE *voice_select, espeak_VOICE **voices)
{//=========================================================================
static int SetVoiceScores(espeak_VOICE *voice_select, espeak_VOICE **voices, int control)
{//======================================================================================
// control: bit0=1 include mbrola voices
int ix;
int score;
int nv; // number of candidates
@@ -1063,9 +1064,13 @@ static int SetVoiceScores(espeak_VOICE *voice_select, espeak_VOICE **voices)
nv = 0;
for(ix=0; ix<n_voices_list; ix++)
{
vp = voices_list[ix];
if(((control & 1) == 0) && (memcmp(vp->identifier,"mb/",3) == 0))
continue;
if((score = ScoreVoice(voice_select, n_parts, lang_len, voices_list[ix])) > 0)
{
voices[nv++] = vp = voices_list[ix];
voices[nv++] = vp;
vp->score = score;
}
}
@@ -1154,7 +1159,7 @@ espeak_VOICE *SelectVoice(espeak_VOICE *voice_select, int *variant)
espeak_ListVoices(NULL); // create the voices list
// select and sort voices for the required language
nv = SetVoiceScores(voice_select,voices);
nv = SetVoiceScores(voice_select,voices,0);
if(nv == 0)
{
@@ -1441,7 +1446,7 @@ ESPEAK_API const espeak_VOICE **espeak_ListVoices(espeak_VOICE *voice_spec)
if(voice_spec)
{
// select the voices which match the voice_spec, and sort them by preference
SetVoiceScores(voice_spec,voices);
SetVoiceScores(voice_spec,voices,1);
return((const espeak_VOICE **)voices);
}