mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-26 21:14:27 +00:00
[1.27.09] Fix for --punct option when used with <say-as>.
lang=hu, shorten "ll". Test: remove differences in vowel lengths depending on the following phoneme. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@64 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
@@ -242,6 +242,7 @@ static keywtab_t keywords[] = {
|
||||
{"palatal", 0x2000000+phPALATAL},
|
||||
{"long", 0x2000000+phLONG},
|
||||
{"brkafter", 0x2000000+phBRKAFTER},
|
||||
{"nonsyllabic",0x2000000+phNONSYLLABIC},
|
||||
|
||||
// voiced / unvoiced
|
||||
{"vcd", 0x2000000+phVOICED},
|
||||
|
||||
+4
-4
@@ -779,7 +779,7 @@ static int GetVowelStress(Translator *tr, unsigned char *phonemes, unsigned char
|
||||
continue;
|
||||
}
|
||||
|
||||
if((ph->type == phVOWEL) && (ph->code != phonSCHWA_SHORT))
|
||||
if((ph->type == phVOWEL) && !(ph->phflags & phNONSYLLABIC))
|
||||
{
|
||||
vowel_stress[count] = (char)stress;
|
||||
if((stress >= 4) && (stress >= max_stress))
|
||||
@@ -892,7 +892,7 @@ void ChangeWordStress(Translator *tr, char *word, int new_stress)
|
||||
p = phonetic;
|
||||
while(*p != 0)
|
||||
{
|
||||
if((phoneme_tab[*p]->type == phVOWEL) && (*p != phonSCHWA_SHORT))
|
||||
if((phoneme_tab[*p]->type == phVOWEL) && !(phoneme_tab[*p]->phflags & phNONSYLLABIC))
|
||||
{
|
||||
if(vowel_stress[ix] != 0)
|
||||
*word++ = stress_phonemes[vowel_stress[ix]];
|
||||
@@ -982,7 +982,7 @@ void Translator::SetWordStress(char *output, unsigned int dictionary_flags, int
|
||||
ix = 1;
|
||||
for(p = phonetic; *p != 0; p++)
|
||||
{
|
||||
if((phoneme_tab[p[0]]->type == phVOWEL) && (p[0] != phonSCHWA_SHORT))
|
||||
if((phoneme_tab[p[0]]->type == phVOWEL) && !(phoneme_tab[p[0]]->phflags & phNONSYLLABIC))
|
||||
{
|
||||
int weight = 0;
|
||||
int lengthened = 0;
|
||||
@@ -1314,7 +1314,7 @@ void Translator::SetWordStress(char *output, unsigned int dictionary_flags, int
|
||||
prev_last_stress = 0;
|
||||
}
|
||||
else
|
||||
if(((ph->type == phVOWEL) && (ph->code != phonSCHWA_SHORT)) || (*p == phonSYLLABIC))
|
||||
if(((ph->type == phVOWEL) && !(ph->phflags & phNONSYLLABIC)) || (*p == phonSYLLABIC))
|
||||
{
|
||||
// a vowel, or a consonant followed by a syllabic consonant marker
|
||||
|
||||
|
||||
+3
-2
@@ -200,9 +200,10 @@ int unicode[80];
|
||||
|
||||
|
||||
|
||||
void DecodePhonemes2(const char *inptr, char *outptr)
|
||||
static void DecodePhonemes2(const char *inptr, char *outptr)
|
||||
//===================================================
|
||||
// Translate from internal phoneme codes into phoneme mnemonics
|
||||
// This version is for Lexicon_De()
|
||||
{
|
||||
unsigned char phcode;
|
||||
unsigned char c;
|
||||
@@ -279,7 +280,7 @@ void DecodePhonemes2(const char *inptr, char *outptr)
|
||||
}
|
||||
}
|
||||
*outptr = 0; /* string terminator */
|
||||
} // end of DecodePhonemes
|
||||
} // end of DecodePhonemes2
|
||||
|
||||
|
||||
void Lexicon_De()
|
||||
|
||||
@@ -55,6 +55,8 @@
|
||||
#define phBEFORENOTVOWEL 0x0c00
|
||||
#define phSWITCHVOICING 0x0800
|
||||
|
||||
#define phNONSYLLABIC 0x100000 // don't count this vowel as a syllable when finding the stress position
|
||||
|
||||
// fixed phoneme code numbers, these can be used from the program code
|
||||
#define phonCONTROL 1
|
||||
#define phonSTRESS_U 2
|
||||
|
||||
+6
-3
@@ -1718,11 +1718,14 @@ f_input = f_in; // for GetC etc
|
||||
|
||||
if(option_phoneme_input)
|
||||
{
|
||||
if(phoneme_mode > 0)
|
||||
phoneme_mode--;
|
||||
else
|
||||
if((c1 == '[') && (c2 == '['))
|
||||
phoneme_mode = 1; // input is phoneme mnemonics, so don't look for punctuation
|
||||
phoneme_mode = -1; // input is phoneme mnemonics, so don't look for punctuation
|
||||
else
|
||||
if((c1 == ']') && (c2 == ']'))
|
||||
phoneme_mode = 0;
|
||||
phoneme_mode = 2; // set phoneme_mode to zero after the next two characters
|
||||
}
|
||||
|
||||
if(c1 == '\n')
|
||||
@@ -1761,7 +1764,7 @@ if(option_ssml) parag=1;
|
||||
linelength = 0;
|
||||
}
|
||||
|
||||
if(option_punctuation && (phoneme_mode==0) && iswpunct(c1))
|
||||
if(option_punctuation && (phoneme_mode==0) && (sayas_mode==0) && iswpunct(c1))
|
||||
{
|
||||
// option is set to explicitly speak punctuation characters
|
||||
// if a list of allowed punctuation has been set up, check whether the character is in it
|
||||
|
||||
+1
-1
@@ -442,7 +442,7 @@ p->pitch1 = p->pitch2 - 20; // post vocalic [r/]
|
||||
end_of_clause = 0;
|
||||
for(p2 = p+1; p2->newword== 0; p2++)
|
||||
{
|
||||
if(p2->type == phVOWEL)
|
||||
if((p2->type == phVOWEL) && !(p2->ph->phflags & phNONSYLLABIC))
|
||||
more_syllables++;
|
||||
}
|
||||
if((p2->newword & 2) && (more_syllables==0))
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
char path_home[120];
|
||||
char wavefile[120];
|
||||
int (* uri_callback)(int, const char *, const char *) = NULL;
|
||||
int (* phoneme_callback)(const char *) = NULL;
|
||||
|
||||
|
||||
static const char *help_text =
|
||||
|
||||
@@ -61,6 +61,7 @@ static espeak_AUDIO_OUTPUT my_mode=AUDIO_OUTPUT_SYNCHRONOUS;
|
||||
static int synchronous_mode = 1;
|
||||
t_espeak_callback* synth_callback = NULL;
|
||||
int (* uri_callback)(int, const char *, const char *) = NULL;
|
||||
int (* phoneme_callback)(const char *) = NULL;
|
||||
|
||||
char path_home[120];
|
||||
|
||||
@@ -657,6 +658,12 @@ ESPEAK_API void espeak_SetUriCallback(int (* UriCallback)(int, const char*, cons
|
||||
uri_callback = UriCallback;
|
||||
}
|
||||
|
||||
|
||||
ESPEAK_API void espeak_SetPhonemeCallback(int (* PhonemeCallback)(const char*))
|
||||
{//===========================================================================
|
||||
phoneme_callback = PhonemeCallback;
|
||||
}
|
||||
|
||||
ESPEAK_API int espeak_Initialize(espeak_AUDIO_OUTPUT output_type, int buf_length, const char *path, int options)
|
||||
{//=============================================================================================================
|
||||
ENTER("espeak_Initialize");
|
||||
|
||||
+3
-2
@@ -180,7 +180,8 @@ int SynthCallback(short *wav, int numsamples, espeak_EVENT *events);
|
||||
sometimes be zero (which does NOT indicate end of synthesis).
|
||||
|
||||
events: an array of espeak_EVENT items which indicate word and sentence events, and
|
||||
also the occurance if <mark> and <audio> elements within the text.
|
||||
also the occurance if <mark> and <audio> elements within the text. The list of
|
||||
events is terminated by an event of type = 0.
|
||||
|
||||
|
||||
Callback returns: 0=continue synthesis, 1=abort synthesis.
|
||||
@@ -266,7 +267,7 @@ espeak_ERROR espeak_Synth(const void *text,
|
||||
|
||||
espeakSSML Elements within < > are treated as SSML elements, or if not recognised are ignored.
|
||||
|
||||
espeakPHONEMES Text within [[ ]] is treated as phonemes codes (in espeak's Hirschenbaum encoding).
|
||||
espeakPHONEMES Text within [[ ]] is treated as phonemes codes (in espeak's Hirshenbaum encoding).
|
||||
|
||||
espeakENDPAUSE If set then a sentence pause is added at the end of the text. If not set then
|
||||
this pause is suppressed.
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.27.08 09.Jul.07";
|
||||
const char *version_string = "1.27.09 12.Jul.07";
|
||||
const int version_phdata = 0x012701;
|
||||
|
||||
int option_device_number = -1;
|
||||
|
||||
@@ -1547,6 +1547,11 @@ int SpeakNextClause(FILE *f_in, const void *text_in, int control)
|
||||
{
|
||||
fprintf(f_trans,"%s\n",translator->phon_out);
|
||||
}
|
||||
if(phoneme_callback != NULL)
|
||||
{
|
||||
phoneme_callback(translator->phon_out);
|
||||
}
|
||||
|
||||
translator->CalcPitches(clause_tone);
|
||||
translator->CalcLengths();
|
||||
|
||||
|
||||
@@ -335,12 +335,11 @@ Translator *SelectTranslator(const char *name)
|
||||
// tr->langopts.param[LOPT_REGRESSIVE_VOICING] = 0x4; // don't propagate over word boundaries
|
||||
tr->langopts.param[LOPT_IT_DOUBLING] = 1;
|
||||
tr->langopts.param[LOPT_COMBINE_WORDS] = 99; // combine some prepositions with the following word
|
||||
tr->langopts.long_stop = 130;
|
||||
|
||||
tr->langopts.numbers = 0x1809 + NUM_ROMAN;
|
||||
SetLetterVowel(tr,'y');
|
||||
tr->langopts.spelling_stress = 1;
|
||||
//SetLengthMods(tr,3); // all equal
|
||||
SetLengthMods(tr,3); // all equal
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -502,6 +502,7 @@ extern char *p_textinput;
|
||||
extern wchar_t *p_wchar_input;
|
||||
extern int ungot_char;
|
||||
extern int (* uri_callback)(int, const char *, const char *);
|
||||
extern int (* phoneme_callback)(const char *);
|
||||
extern void SetLengthMods(Translator *tr, int value);
|
||||
|
||||
Translator *SelectTranslator(const char *name);
|
||||
|
||||
Reference in New Issue
Block a user