git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@99 d46cf337-b52f-0410-862d-fd96e6ae7743master
| @@ -1,3 +1,6 @@ | |||
| _?? @11 // unrecognized character | |||
| //numbers | |||
| _0 liN35 | |||
| _1 ji55 | |||
| @@ -15,6 +15,20 @@ INSTALL = /usr/bin/install | |||
| LN_SF = /bin/ln -sf | |||
| MKDIR = mkdir -p | |||
| #AUDIO = portaudio | |||
| AUDIO = pulseaudio | |||
| ifeq ($(AUDIO),pulseaudio) | |||
| WAVE=wave_pulse.cpp | |||
| LIB_AUDIO=pulse | |||
| USE_AUDIO=USE_PULSEAUDIO | |||
| else | |||
| #portaudio | |||
| WAVE=wave.cpp | |||
| LIB_AUDIO=portaudio | |||
| USE_AUDIO=USE_PORTAUDIO | |||
| 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 \ | |||
| @@ -24,22 +38,23 @@ 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.cpp debug.cpp | |||
| espeak_command.cpp event.cpp fifo.cpp $(WAVE) debug.cpp | |||
| SRCS1=$(speak_SOURCES) | |||
| OBJS1=$(patsubst %.cpp,%.o,$(SRCS1)) | |||
| LIBS1=-lstdc++ -lportaudio -lpthread | |||
| LIBS1=-lstdc++ -l$(LIB_AUDIO) -lpthread | |||
| SRCS2=$(libespeak_SOURCES) | |||
| OBJS2=$(patsubst %.cpp,x_%.o,$(SRCS2)) | |||
| LIBS2=-lstdc++ -lportaudio -lpthread | |||
| LIBS2=-lstdc++ -l$(LIB_AUDIO) -lpthread | |||
| SRCS3 = espeak.cpp | |||
| OBJS3=$(patsubst %.cpp,%.o,$(SRCS3)) | |||
| LIBS3=-lstdc++ ./libespeak.so | |||
| CXXFLAGS=-O2 | |||
| CXXFLAGS=-O2 -D$(USE_AUDIO) | |||
| #CXXFLAGS=-D$(USE_AUDIO) -ggdb -DDEBUG_ENABLED | |||
| all: $(BIN_NAME) $(LIB_NAME) $(STATIC_LIB_NAME) $(BIN2_NAME) | |||
| @@ -261,7 +261,7 @@ static char nullstring[] = {0}; | |||
| text_mode = 0; | |||
| } | |||
| else | |||
| if(ix == BITNUM_FLAG_DICTTEXT) | |||
| if(ix == BITNUM_FLAG_TEXTMODE) | |||
| { | |||
| text_not_phonemes = 1; | |||
| } | |||
| @@ -371,10 +371,17 @@ static char nullstring[] = {0}; | |||
| return(0); /* blank line */ | |||
| } | |||
| if(text_not_phonemes || text_mode) | |||
| if(text_mode) | |||
| text_not_phonemes = 1; | |||
| if(text_not_phonemes != translator->langopts.textmode) | |||
| { | |||
| flag_codes[n_flag_codes++] = BITNUM_FLAG_TEXTMODE; | |||
| } | |||
| if(text_not_phonemes) | |||
| { | |||
| strcpy(encoded_ph,phonetic); // this is replacement text, so don't encode as phonemes | |||
| flag_codes[n_flag_codes++] = BITNUM_FLAG_DICTTEXT; | |||
| } | |||
| else | |||
| { | |||
| @@ -2813,12 +2813,20 @@ const char *Translator::LookupDict2(const char *word, const char *word2, char *p | |||
| { | |||
| unsigned int flags1 = 0; | |||
| char ph_decoded[N_WORD_PHONEMES]; | |||
| int textmode; | |||
| DecodePhonemes(phonetic,ph_decoded); | |||
| if(flags != NULL) | |||
| flags1 = *flags; | |||
| if((dictionary_flags & FLAG_DICTTEXT) == 0) | |||
| if((dictionary_flags & FLAG_TEXTMODE) == 0) | |||
| textmode = 0; | |||
| else | |||
| textmode = 1; | |||
| if(textmode == translator->langopts.textmode) | |||
| { | |||
| // only show this line if the word translates to phonemes, not replacement text | |||
| fprintf(f_trans,"Found: %s [%s] %s\n",word1,ph_decoded,print_dflags(flags1)); | |||
| } | |||
| } | |||
| @@ -2908,11 +2916,15 @@ int Translator::LookupDictList(char **wordptr, char *ph_out, unsigned int *flags | |||
| if(found) | |||
| { | |||
| if(*flags & FLAG_DICTTEXT) | |||
| // if textmode is the default, then words which have phonemes are marked. | |||
| if(langopts.textmode) | |||
| *flags ^= FLAG_TEXTMODE; | |||
| if(*flags & FLAG_TEXTMODE) | |||
| { | |||
| // the word translates to replacement text, not to phonemes | |||
| if(end_flags & FLAG_ALLOW_DICTTEXT) | |||
| if(end_flags & FLAG_ALLOW_TEXTMODE) | |||
| { | |||
| // only use replacement text if this is the original word, not if a prefix or suffix has been removed | |||
| word_replacement[0] = 0; | |||
| @@ -29,6 +29,7 @@ | |||
| #define PLATFORM_POSIX | |||
| #define PATHSEP '/' | |||
| #define USE_PORTAUDIO | |||
| //#define USE_PULSEAUDIO | |||
| #define USE_NANOSLEEP | |||
| #define __cdecl | |||
| #define ESPEAK_API extern "C" | |||
| @@ -35,7 +35,7 @@ | |||
| #include "translate.h" | |||
| #include "wave.h" | |||
| const char *version_string = "1.29.16 01.Nov.07"; | |||
| const char *version_string = "1.29.17 08.Nov.07"; | |||
| const int version_phdata = 0x012901; | |||
| int option_device_number = -1; | |||
| @@ -39,6 +39,7 @@ | |||
| #define L_qa 0x716100 | |||
| #define L_grc 0x677263 // grc Ancient Greek | |||
| #define L_zhy 0x7a6879 // zhy | |||
| #define OFFSET_GREEK 0x380 | |||
| @@ -647,20 +648,26 @@ SetLengthMods(tr,3); // all equal | |||
| break; | |||
| case L('z','h'): | |||
| case L_zhy: | |||
| { | |||
| static int stress_lengths_qaa[8] = {220,150, 230,230, 230,0, 230,250}; | |||
| static int stress_amps_qaa[] = {22,16, 22,22, 22,22, 22,22 }; | |||
| tr = new Translator(); | |||
| SetupTranslator(tr,stress_lengths_qaa,stress_amps_qaa); | |||
| static int stress_lengths_zh[8] = {220,150, 230,230, 230,0, 230,250}; | |||
| static int stress_amps_zh[] = {22,16, 22,22, 22,22, 22,22 }; | |||
| tr = new Translator; | |||
| SetupTranslator(tr,stress_lengths_zh,stress_amps_zh); | |||
| tr->langopts.stress_rule = 3; // stress on final syllable of a "word" | |||
| tr->langopts.stress_flags = 1; // don't automatically set diminished stress (may be set in the intonation module) | |||
| tr->langopts.vowel_pause = 0; | |||
| tr->langopts.intonation = 1; // Tone language, use CalcPitches_Tone() rather than CalcPitches() | |||
| tr->langopts.length_mods0 = tr->langopts.length_mods; // don't lengthen vowels in the last syllable | |||
| tr->langopts.tone_numbers = 9; // a number after letters indicates a tone number (eg. pinyin or jyutping) | |||
| tr->langopts.tone_numbers = 1; // a number after letters indicates a tone number (eg. pinyin or jyutping) | |||
| tr->langopts.ideographs = 1; | |||
| tr->langopts.word_gap = 0x5; // length of a final vowel is less dependent on the next consonant, don't merge consonant with next word | |||
| if(name2 == L('z','h')) | |||
| { | |||
| tr->langopts.textmode = 1; | |||
| } | |||
| } | |||
| break; | |||
| @@ -642,7 +642,7 @@ int Translator::TranslateWord(char *word1, int next_pause, WORD_TAB *wtab) | |||
| else | |||
| { | |||
| spell_word = 0; | |||
| found = LookupDictList(&word1,phonemes,&dictionary_flags,FLAG_ALLOW_DICTTEXT | wflags << 16); // the original word | |||
| found = LookupDictList(&word1,phonemes,&dictionary_flags,FLAG_ALLOW_TEXTMODE | wflags << 16); // the original word | |||
| if(phonemes[0] == phonSWITCH) | |||
| { | |||
| @@ -64,8 +64,8 @@ | |||
| #define FLAG_PASTF 0x8000000 /* past tense follows */ | |||
| #define FLAG_VERB_EXT 0x10000000 /* extend the 'verb follows' */ | |||
| #define FLAG_DICTTEXT 0x20000000 // word translates to replacement text, not phonemes | |||
| #define BITNUM_FLAG_DICTTEXT 29 | |||
| #define FLAG_TEXTMODE 0x20000000 // word translates to replacement text, not phonemes | |||
| #define BITNUM_FLAG_TEXTMODE 29 | |||
| #define FLAG_PAUSE1 0x40000000 // shorter prepause | |||
| #define FLAG_FOUND 0x80000000 /* pronunciation was found in the dictionary list */ | |||
| @@ -97,7 +97,7 @@ | |||
| #define SUFX_Q 0x4000 // don't retranslate | |||
| #define SUFX_T 0x10000 // don't affect the stress position in the stem | |||
| #define FLAG_ALLOW_DICTTEXT 0x02 // allow dictionary to translate to text rather than phonemes | |||
| #define FLAG_ALLOW_TEXTMODE 0x02 // allow dictionary to translate to text rather than phonemes | |||
| #define FLAG_SUFX 0x04 | |||
| #define FLAG_SUFX_S 0x08 | |||
| #define FLAG_SUFX_E_ADDED 0x10 | |||
| @@ -321,6 +321,7 @@ typedef struct { | |||
| char spelling_stress; // 0=default, 1=stress first letter | |||
| char tone_numbers; | |||
| char ideographs; // treat as separate words | |||
| char textmode; // the meaning of FLAG_TEXTMODE is reversed | |||
| int testing; // testing options: bit 1= specify stressed syllable in the form: "outdoor/2" | |||
| const unsigned int *replace_chars; // characters to be substitutes | |||
| } LANGUAGE_OPTIONS; | |||
| @@ -892,7 +892,7 @@ int PeaksToHarmspect(wavegen_peaks_t *peaks, int pitch, int *htab, int control) | |||
| { | |||
| htab[h++] += pk_shape[(fp-f)/(p->left>>8)] * p->height; | |||
| } | |||
| for(;f < fhi; f+=pitch) | |||
| for(; f < fhi; f+=pitch) | |||
| { | |||
| htab[h++] += pk_shape[(f-fp)/(p->right>>8)] * p->height; | |||
| } | |||
| @@ -969,7 +969,8 @@ static void AdvanceParameters() | |||
| x = ((int)(Flutter_tab[Flutter_ix >> 6])-0x80) * flutter_amp; | |||
| Flutter_ix += Flutter_inc; | |||
| pitch += x; | |||
| if(pitch < 102400) | |||
| pitch = 102400; // min pitch, 25 Hz (25 << 12) | |||
| if(samplecount == samplecount_start) | |||
| return; | |||