mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 05:35:35 +00:00
[1.30.01] espeakChar() & say-as tts:char, speak the unicode number for unknown characters.
lang=ta: change stress rule to first syllable. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@131 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+16
-41
@@ -3,7 +3,7 @@ INCDIR=/usr/include/espeak
|
||||
LIBDIR=/usr/lib
|
||||
DATADIR=/usr/share/espeak-data
|
||||
|
||||
RELEASE = 1.30
|
||||
RELEASE = 1.31
|
||||
BIN2_NAME = espeak
|
||||
LIB_NAME = libespeak.so
|
||||
STATIC_LIB_NAME = libespeak.a
|
||||
@@ -14,70 +14,45 @@ INSTALL = /usr/bin/install
|
||||
LN_SF = /bin/ln -sf
|
||||
MKDIR = mkdir -p
|
||||
|
||||
#AUDIO = portaudio
|
||||
AUDIO = pulseaudio
|
||||
#BIN_NAME = speak
|
||||
|
||||
BIN_NAME = speak
|
||||
|
||||
ifeq ($(AUDIO),pulseaudio)
|
||||
WAVE=wave_pulse.cpp
|
||||
LIB_AUDIO=pulse
|
||||
USE_AUDIO=USE_PULSEAUDIO
|
||||
# the speak executable is not yet compliant with PulseAudio,
|
||||
# speak_SOURCES defined for avoiding compilation errors.
|
||||
speak_SOURCES = speak.cpp compiledict.cpp dictionary.cpp intonation.cpp \
|
||||
readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \
|
||||
synthdata.cpp synthesize.cpp translate.cpp tr_english.cpp \
|
||||
tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp \
|
||||
espeak_command.cpp event.cpp fifo.cpp $(WAVE) debug.cpp
|
||||
else
|
||||
#portaudio
|
||||
WAVE=wave.cpp
|
||||
LIB_AUDIO=portaudio
|
||||
USE_AUDIO=USE_PORTAUDIO
|
||||
speak_SOURCES = speak.cpp compiledict.cpp dictionary.cpp intonation.cpp \
|
||||
readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \
|
||||
synthdata.cpp synthesize.cpp translate.cpp tr_english.cpp \
|
||||
tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp
|
||||
|
||||
endif
|
||||
|
||||
speak_SOURCES = speak.cpp compiledict.cpp dictionary.cpp intonation.cpp \
|
||||
readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \
|
||||
synthdata.cpp synthesize.cpp translate.cpp tr_english.cpp \
|
||||
tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp
|
||||
# speak_SOURCES = speak.cpp compiledict.cpp dictionary.cpp intonation.cpp \
|
||||
# readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \
|
||||
# synthdata.cpp synthesize.cpp translate.cpp tr_english.cpp \
|
||||
# tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp
|
||||
|
||||
libespeak_SOURCES = speak_lib.cpp compiledict.cpp dictionary.cpp intonation.cpp \
|
||||
readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \
|
||||
synthdata.cpp synthesize.cpp translate.cpp tr_english.cpp \
|
||||
tr_languages.cpp voices.cpp wavegen.cpp phonemelist.cpp \
|
||||
espeak_command.cpp event.cpp fifo.cpp $(WAVE) debug.cpp
|
||||
espeak_command.cpp event.cpp fifo.cpp wave_pulse.cpp debug.cpp
|
||||
|
||||
|
||||
SRCS1=$(speak_SOURCES)
|
||||
OBJS1=$(patsubst %.cpp,%.o,$(SRCS1))
|
||||
LIBS1=-lstdc++ -l$(LIB_AUDIO) -lpthread
|
||||
LIBS1=-lstdc++ -lpulse -lpthread
|
||||
|
||||
SRCS2=$(libespeak_SOURCES)
|
||||
OBJS2=$(patsubst %.cpp,x_%.o,$(SRCS2))
|
||||
LIBS2=-lstdc++ -l$(LIB_AUDIO) -lpthread
|
||||
LIBS2=-lstdc++ -lpulse -lpthread
|
||||
|
||||
SRCS3 = espeak.cpp
|
||||
OBJS3=$(patsubst %.cpp,%.o,$(SRCS3))
|
||||
LIBS3=-lstdc++ ./libespeak.so
|
||||
|
||||
#CXXFLAGS=-O2 -D$(USE_AUDIO)
|
||||
CXXFLAGS=-D$(USE_AUDIO) -ggdb -DDEBUG_ENABLED
|
||||
CXXFLAGS=-O2 -DUSE_PULSEAUDIO
|
||||
#CXXFLAGS=-DUSE_PULSEAUDIO -ggdb -DDEBUG_ENABLED
|
||||
|
||||
|
||||
all: $(BIN_NAME) $(LIB_NAME) $(STATIC_LIB_NAME) $(BIN2_NAME)
|
||||
#all: $(BIN_NAME) $(LIB_NAME) $(STATIC_LIB_NAME) $(BIN2_NAME)
|
||||
all: $(LIB_NAME) $(STATIC_LIB_NAME) $(BIN2_NAME)
|
||||
mv $(LIB_NAME) $(LIB_NAME).$(LIBTAG)
|
||||
|
||||
.cpp.o:
|
||||
$(CXX) $(CXXFLAGS) -D PATH_ESPEAK_DATA=\"$(DATADIR)\" -Wall -pedantic -I. -c -fno-exceptions $<
|
||||
|
||||
$(BIN_NAME): $(OBJS1)
|
||||
$(CXX) -o $@ $(OBJS1) $(LIBS1)
|
||||
# $(BIN_NAME): $(OBJS1)
|
||||
# $(CXX) -o $@ $(OBJS1) $(LIBS1)
|
||||
|
||||
$(BIN2_NAME): $(OBJS3) $(LIB_NAME)
|
||||
$(CXX) -o $@ $(OBJS3) $(LIBS3)
|
||||
@@ -98,7 +73,7 @@ clean:
|
||||
rm -f *.o *.a *~
|
||||
|
||||
distclean: clean
|
||||
rm -f $(BIN_NAME)
|
||||
# rm -f $(BIN_NAME)
|
||||
rm -f $(BIN2_NAME)
|
||||
rm -f $(LIB_NAME)*
|
||||
|
||||
|
||||
+1
-1
@@ -2390,7 +2390,7 @@ int Translator::TranslateRules(char *p_start, char *phonemes, int ph_size, char
|
||||
continue; // start again at the beginning of the word
|
||||
}
|
||||
else
|
||||
if((letter >= 0x3200) && (letter < 0xa700))
|
||||
if((letter >= 0x3200) && (letter < 0xa700) && (end_phonemes != NULL))
|
||||
{
|
||||
// ideograms
|
||||
// outside the range of the accent table, speak the unknown symbol sound
|
||||
|
||||
+75
-49
@@ -36,6 +36,51 @@
|
||||
|
||||
|
||||
|
||||
void Translator::LookupLetter(int letter, int next_byte, char *ph_buf1)
|
||||
{//==================================================================
|
||||
int len;
|
||||
unsigned char *p;
|
||||
static char single_letter[10] = {0,0};
|
||||
char ph_stress[2];
|
||||
char ph_buf3[30];
|
||||
|
||||
len = utf8_out(letter,&single_letter[2]);
|
||||
single_letter[len+2] = ' ';
|
||||
|
||||
if(next_byte != ' ')
|
||||
next_byte = RULE_SPELLING;
|
||||
single_letter[3+len] = next_byte; // follow by space-space if the end of the word, or space-0x31
|
||||
|
||||
single_letter[1] = '_';
|
||||
if(Lookup(&single_letter[1],ph_buf3) == 0)
|
||||
{
|
||||
single_letter[1] = ' ';
|
||||
if(Lookup(&single_letter[2],ph_buf3) == 0)
|
||||
{
|
||||
TranslateRules(&single_letter[2], ph_buf3, sizeof(ph_buf3), NULL,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
if(ph_buf3[0] == 0)
|
||||
{
|
||||
ph_buf1[0] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// at a stress marker at the start of the letter name, unless one is already marked
|
||||
ph_stress[0] = phonSTRESS_P;
|
||||
ph_stress[1] = 0;
|
||||
|
||||
for(p=(unsigned char *)ph_buf3; *p != 0; p++)
|
||||
{
|
||||
if(phoneme_tab[*p]->type == phSTRESS)
|
||||
ph_stress[0] = 0; // stress is already marked
|
||||
}
|
||||
sprintf(ph_buf1,"%s%s",ph_stress,ph_buf3);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int Translator::TranslateLetter(char *word, char *phonemes, int control)
|
||||
{//=====================================================================
|
||||
// get pronunciation for an isolated letter
|
||||
@@ -44,12 +89,12 @@ int Translator::TranslateLetter(char *word, char *phonemes, int control)
|
||||
int n_bytes;
|
||||
int letter;
|
||||
int len;
|
||||
int next;
|
||||
unsigned char *p;
|
||||
char ph_stress[2];
|
||||
char *p2;
|
||||
char *pbuf;
|
||||
char capital[20];
|
||||
char ph_buf[30];
|
||||
char ph_buf[50];
|
||||
char ph_buf2[50];
|
||||
char hexbuf[6];
|
||||
static char single_letter[10] = {0,0};
|
||||
|
||||
ph_buf[0] = 0;
|
||||
@@ -81,23 +126,7 @@ int Translator::TranslateLetter(char *word, char *phonemes, int control)
|
||||
return(n_bytes);
|
||||
}
|
||||
|
||||
len = utf8_out(letter,&single_letter[2]);
|
||||
single_letter[len+2] = ' ';
|
||||
|
||||
next = RULE_SPELLING;
|
||||
if(word[n_bytes] == ' ')
|
||||
next = ' ';
|
||||
single_letter[3+len] = next; // follow by space-space if the end of the word, or space-0x31
|
||||
|
||||
single_letter[1] = '_';
|
||||
if(Lookup(&single_letter[1],ph_buf) == 0)
|
||||
{
|
||||
single_letter[1] = ' ';
|
||||
if(Lookup(&single_letter[2],ph_buf) == 0)
|
||||
{
|
||||
TranslateRules(&single_letter[2], ph_buf, sizeof(ph_buf), NULL,0,0);
|
||||
}
|
||||
}
|
||||
LookupLetter(letter, word[n_bytes], ph_buf);
|
||||
|
||||
if(ph_buf[0] == phonSWITCH)
|
||||
{
|
||||
@@ -112,20 +141,22 @@ int Translator::TranslateLetter(char *word, char *phonemes, int control)
|
||||
|
||||
if((ph_buf[0]==0) && !iswspace(letter))
|
||||
Lookup("_??",ph_buf);
|
||||
}
|
||||
|
||||
// at a stress marker at the start of the letter name, unless one is already marked
|
||||
ph_stress[0] = phonSTRESS_P;
|
||||
ph_stress[1] = 0;
|
||||
|
||||
for(p=(unsigned char *)ph_buf; *p != 0; p++)
|
||||
{
|
||||
if(phoneme_tab[*p]->type == phSTRESS)
|
||||
ph_stress[0] = 0; // stress is already marked
|
||||
if((control==4) && (ph_buf[0] != 0))
|
||||
{
|
||||
// speak the hexadecimal number of the character code
|
||||
sprintf(hexbuf,"%x",letter);
|
||||
pbuf = ph_buf;
|
||||
for(p2 = hexbuf; *p2 != 0; p2++)
|
||||
{
|
||||
pbuf += strlen(pbuf);
|
||||
LookupLetter(*p2, 0, pbuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
len = strlen(phonemes);
|
||||
sprintf(ph_buf2,"%c%s%s%s",0xff,capital,ph_stress,ph_buf); // the 0xff marker will be removed or replaced in SetSpellingStress()
|
||||
sprintf(ph_buf2,"%c%s%s",0xff,capital,ph_buf); // the 0xff marker will be removed or replaced in SetSpellingStress()
|
||||
if((len + strlen(ph_buf2)) < N_WORD_PHONEMES)
|
||||
{
|
||||
strcpy(&phonemes[len],ph_buf2);
|
||||
@@ -169,7 +200,7 @@ void Translator::SetSpellingStress(char *phonemes, int control)
|
||||
}
|
||||
else
|
||||
{
|
||||
if((count != n_stress) && (control < 4))
|
||||
if(count != n_stress)
|
||||
{
|
||||
if(((count % 3) != 0) || (count == n_stress-1))
|
||||
c = phonSTRESS_3; // reduce to secondary stress
|
||||
@@ -733,24 +764,19 @@ int Translator::TranslateNumber_1(char *word, char *ph_out, unsigned int *flags,
|
||||
switch(langopts.numbers & 0x6000)
|
||||
{
|
||||
case 0x4000:
|
||||
if(decimal_count < 4)
|
||||
// French/Polish decimal fraction
|
||||
while(word[n_digits] == '0')
|
||||
{
|
||||
// Polish decimal fraction
|
||||
if ((word[n_digits] != '0'))
|
||||
{
|
||||
LookupNum3(atoi(&word[n_digits]),buf1,0,0,0);
|
||||
strcat(ph_out,buf1);
|
||||
n_digits += decimal_count;
|
||||
}
|
||||
else
|
||||
if ((word[n_digits+1] != '0'))
|
||||
{
|
||||
Lookup("_0",buf1);
|
||||
strcat(ph_out,buf1);
|
||||
LookupNum3(atoi(&word[n_digits]),buf1,0,0,0);
|
||||
strcat(ph_out,buf1);
|
||||
n_digits += decimal_count;
|
||||
}
|
||||
Lookup("_0",buf1);
|
||||
strcat(ph_out,buf1);
|
||||
decimal_count--;
|
||||
n_digits++;
|
||||
}
|
||||
if(decimal_count < 6)
|
||||
{
|
||||
LookupNum3(atoi(&word[n_digits]),buf1,0,0,0);
|
||||
strcat(ph_out,buf1);
|
||||
n_digits += decimal_count;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.31 19.Jan.08";
|
||||
const char *version_string = "1.31.01 23.Jan.08";
|
||||
const int version_phdata = 0x013100;
|
||||
|
||||
int option_device_number = -1;
|
||||
|
||||
@@ -277,7 +277,7 @@ Translator *SelectTranslator(const char *name)
|
||||
tr->langopts.stress_flags = 0x0024; // don't use secondary stress
|
||||
tr->langopts.param[LOPT_IT_LENGTHEN] = 1; // remove lengthen indicator from unstressed syllables
|
||||
|
||||
tr->langopts.numbers = 0x1509 + NUM_NOPAUSE | NUM_ROMAN;
|
||||
tr->langopts.numbers = 0x1509 + 0x4000 + NUM_NOPAUSE | NUM_ROMAN;
|
||||
SetLetterVowel(tr,'y');
|
||||
}
|
||||
break;
|
||||
@@ -623,17 +623,15 @@ SetLengthMods(tr,3); // all equal
|
||||
|
||||
case L('t','a'):
|
||||
{
|
||||
static const short stress_lengths_ta[8] = {190, 190, 210, 210, 0, 0, 220, 220};
|
||||
static const unsigned char stress_amps_ta[8] = {17,14, 20,19, 20,24, 24,22 };
|
||||
static const short stress_lengths_ta[8] = {190, 190, 200, 200, 0, 0, 220, 220};
|
||||
static const unsigned char stress_amps_ta[8] = {18,18, 18,18, 20,20, 22,22 };
|
||||
|
||||
tr = new Translator();
|
||||
SetupTranslator(tr,stress_lengths_ta,stress_amps_ta);
|
||||
tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable
|
||||
|
||||
tr->langopts.stress_rule = 6; // stress on last heaviest syllable, excluding final syllable
|
||||
tr->langopts.stress_rule = 1;
|
||||
tr->langopts.stress_flags = 0x10004; // use 'diminished' for unstressed final syllable
|
||||
// tr->langopts.numbers = 0x811;
|
||||
// tr->langopts.numbers2 = 0x100;
|
||||
tr->letter_bits_offset = OFFSET_TAMIL;
|
||||
|
||||
memset(tr->letter_bits,0,sizeof(tr->letter_bits));
|
||||
|
||||
@@ -427,6 +427,7 @@ private:
|
||||
const char *LookupDict2(const char *word, const char *word2, char *phonetic, unsigned int *flags, int end_flags, WORD_TAB *wtab);
|
||||
const char *LookupSpecial(const char *string);
|
||||
const char *LookupCharName(int c);
|
||||
void LookupLetter(int letter, int next_byte, char *ph_buf);
|
||||
int LookupNum2(int value, int control, char *ph_out);
|
||||
int LookupNum3(int value, char *ph_out, int suppress_null, int thousandplex, int prev_thousands);
|
||||
int LookupThousands(int value, int thousandplex, char *ph_out);
|
||||
|
||||
Reference in New Issue
Block a user