git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@99 d46cf337-b52f-0410-862d-fd96e6ae7743master
_?? @11 // unrecognized character | |||||
//numbers | //numbers | ||||
_0 liN35 | _0 liN35 | ||||
_1 ji55 | _1 ji55 |
LN_SF = /bin/ln -sf | LN_SF = /bin/ln -sf | ||||
MKDIR = mkdir -p | 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 \ | speak_SOURCES = speak.cpp compiledict.cpp dictionary.cpp intonation.cpp \ | ||||
readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \ | readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \ | ||||
synthdata.cpp synthesize.cpp translate.cpp tr_english.cpp \ | synthdata.cpp synthesize.cpp translate.cpp tr_english.cpp \ | ||||
readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \ | readclause.cpp setlengths.cpp numbers.cpp synth_mbrola.cpp \ | ||||
synthdata.cpp synthesize.cpp translate.cpp tr_english.cpp \ | synthdata.cpp synthesize.cpp translate.cpp tr_english.cpp \ | ||||
tr_languages.cpp voices.cpp wavegen.cpp phonemelist.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) | SRCS1=$(speak_SOURCES) | ||||
OBJS1=$(patsubst %.cpp,%.o,$(SRCS1)) | OBJS1=$(patsubst %.cpp,%.o,$(SRCS1)) | ||||
LIBS1=-lstdc++ -lportaudio -lpthread | LIBS1=-lstdc++ -l$(LIB_AUDIO) -lpthread | ||||
SRCS2=$(libespeak_SOURCES) | SRCS2=$(libespeak_SOURCES) | ||||
OBJS2=$(patsubst %.cpp,x_%.o,$(SRCS2)) | OBJS2=$(patsubst %.cpp,x_%.o,$(SRCS2)) | ||||
LIBS2=-lstdc++ -lportaudio -lpthread | LIBS2=-lstdc++ -l$(LIB_AUDIO) -lpthread | ||||
SRCS3 = espeak.cpp | SRCS3 = espeak.cpp | ||||
OBJS3=$(patsubst %.cpp,%.o,$(SRCS3)) | OBJS3=$(patsubst %.cpp,%.o,$(SRCS3)) | ||||
LIBS3=-lstdc++ ./libespeak.so | 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) | all: $(BIN_NAME) $(LIB_NAME) $(STATIC_LIB_NAME) $(BIN2_NAME) |
text_mode = 0; | text_mode = 0; | ||||
} | } | ||||
else | else | ||||
if(ix == BITNUM_FLAG_DICTTEXT) | if(ix == BITNUM_FLAG_TEXTMODE) | ||||
{ | { | ||||
text_not_phonemes = 1; | text_not_phonemes = 1; | ||||
} | } | ||||
return(0); /* blank line */ | 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 | strcpy(encoded_ph,phonetic); // this is replacement text, so don't encode as phonemes | ||||
flag_codes[n_flag_codes++] = BITNUM_FLAG_DICTTEXT; | |||||
} | } | ||||
else | else | ||||
{ | { |
{ | { | ||||
unsigned int flags1 = 0; | unsigned int flags1 = 0; | ||||
char ph_decoded[N_WORD_PHONEMES]; | char ph_decoded[N_WORD_PHONEMES]; | ||||
int textmode; | |||||
DecodePhonemes(phonetic,ph_decoded); | DecodePhonemes(phonetic,ph_decoded); | ||||
if(flags != NULL) | if(flags != NULL) | ||||
flags1 = *flags; | 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)); | fprintf(f_trans,"Found: %s [%s] %s\n",word1,ph_decoded,print_dflags(flags1)); | ||||
} | } | ||||
} | } | ||||
if(found) | 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 | // 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 | // only use replacement text if this is the original word, not if a prefix or suffix has been removed | ||||
word_replacement[0] = 0; | word_replacement[0] = 0; |
#define PLATFORM_POSIX | #define PLATFORM_POSIX | ||||
#define PATHSEP '/' | #define PATHSEP '/' | ||||
#define USE_PORTAUDIO | #define USE_PORTAUDIO | ||||
//#define USE_PULSEAUDIO | |||||
#define USE_NANOSLEEP | #define USE_NANOSLEEP | ||||
#define __cdecl | #define __cdecl | ||||
#define ESPEAK_API extern "C" | #define ESPEAK_API extern "C" |
#include "translate.h" | #include "translate.h" | ||||
#include "wave.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; | const int version_phdata = 0x012901; | ||||
int option_device_number = -1; | int option_device_number = -1; |
#define L_qa 0x716100 | #define L_qa 0x716100 | ||||
#define L_grc 0x677263 // grc Ancient Greek | #define L_grc 0x677263 // grc Ancient Greek | ||||
#define L_zhy 0x7a6879 // zhy | |||||
#define OFFSET_GREEK 0x380 | #define OFFSET_GREEK 0x380 | ||||
break; | break; | ||||
case L('z','h'): | case L('z','h'): | ||||
case L_zhy: | |||||
{ | { | ||||
static int stress_lengths_qaa[8] = {220,150, 230,230, 230,0, 230,250}; | static int stress_lengths_zh[8] = {220,150, 230,230, 230,0, 230,250}; | ||||
static int stress_amps_qaa[] = {22,16, 22,22, 22,22, 22,22 }; | static int stress_amps_zh[] = {22,16, 22,22, 22,22, 22,22 }; | ||||
tr = new Translator(); | tr = new Translator; | ||||
SetupTranslator(tr,stress_lengths_qaa,stress_amps_qaa); | SetupTranslator(tr,stress_lengths_zh,stress_amps_zh); | ||||
tr->langopts.stress_rule = 3; // stress on final syllable of a "word" | 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.stress_flags = 1; // don't automatically set diminished stress (may be set in the intonation module) | ||||
tr->langopts.vowel_pause = 0; | tr->langopts.vowel_pause = 0; | ||||
tr->langopts.intonation = 1; // Tone language, use CalcPitches_Tone() rather than CalcPitches() | 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.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.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 | 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; | break; | ||||
else | else | ||||
{ | { | ||||
spell_word = 0; | 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) | if(phonemes[0] == phonSWITCH) | ||||
{ | { |
#define FLAG_PASTF 0x8000000 /* past tense follows */ | #define FLAG_PASTF 0x8000000 /* past tense follows */ | ||||
#define FLAG_VERB_EXT 0x10000000 /* extend the 'verb follows' */ | #define FLAG_VERB_EXT 0x10000000 /* extend the 'verb follows' */ | ||||
#define FLAG_DICTTEXT 0x20000000 // word translates to replacement text, not phonemes | #define FLAG_TEXTMODE 0x20000000 // word translates to replacement text, not phonemes | ||||
#define BITNUM_FLAG_DICTTEXT 29 | #define BITNUM_FLAG_TEXTMODE 29 | ||||
#define FLAG_PAUSE1 0x40000000 // shorter prepause | #define FLAG_PAUSE1 0x40000000 // shorter prepause | ||||
#define FLAG_FOUND 0x80000000 /* pronunciation was found in the dictionary list */ | #define FLAG_FOUND 0x80000000 /* pronunciation was found in the dictionary list */ | ||||
#define SUFX_Q 0x4000 // don't retranslate | #define SUFX_Q 0x4000 // don't retranslate | ||||
#define SUFX_T 0x10000 // don't affect the stress position in the stem | #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 0x04 | ||||
#define FLAG_SUFX_S 0x08 | #define FLAG_SUFX_S 0x08 | ||||
#define FLAG_SUFX_E_ADDED 0x10 | #define FLAG_SUFX_E_ADDED 0x10 | ||||
char spelling_stress; // 0=default, 1=stress first letter | char spelling_stress; // 0=default, 1=stress first letter | ||||
char tone_numbers; | char tone_numbers; | ||||
char ideographs; // treat as separate words | 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" | int testing; // testing options: bit 1= specify stressed syllable in the form: "outdoor/2" | ||||
const unsigned int *replace_chars; // characters to be substitutes | const unsigned int *replace_chars; // characters to be substitutes | ||||
} LANGUAGE_OPTIONS; | } LANGUAGE_OPTIONS; |
{ | { | ||||
htab[h++] += pk_shape[(fp-f)/(p->left>>8)] * p->height; | 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; | htab[h++] += pk_shape[(f-fp)/(p->right>>8)] * p->height; | ||||
} | } | ||||
x = ((int)(Flutter_tab[Flutter_ix >> 6])-0x80) * flutter_amp; | x = ((int)(Flutter_tab[Flutter_ix >> 6])-0x80) * flutter_amp; | ||||
Flutter_ix += Flutter_inc; | Flutter_ix += Flutter_inc; | ||||
pitch += x; | pitch += x; | ||||
if(pitch < 102400) | |||||
pitch = 102400; // min pitch, 25 Hz (25 << 12) | |||||
if(samplecount == samplecount_start) | if(samplecount == samplecount_start) | ||||
return; | return; |