Allow combining accent characters inside a word (don't cause the word to be spelled). Add command line options: --path --phonout git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@204 d46cf337-b52f-0410-862d-fd96e6ae7743master
| @@ -19,6 +19,7 @@ | |||
| // letter names, as they are spoken as a single character in text | |||
| // precede by _ to distinguish from pronunciation as a language word | |||
| test h'EloU | |||
| _a eI | |||
| b bi: | |||
| @@ -236,7 +237,12 @@ U+2cc s'Ek@ndrIstr,Es | |||
| // combining diacritics | |||
| U+300 grA:v_ | |||
| U+301 a2kju:t_ | |||
| U+302 s3:kVmflEks_ | |||
| U+303 tIld@_ | |||
| U+304 makr0n_ | |||
| U+306 brEv_ | |||
| U+308 daI@ri:sI2s | |||
| U+30a rINg_ | |||
| U+31e a2pr'0ksIm@nt_ | |||
| U+325 rINg_ | |||
| @@ -2520,6 +2520,11 @@ int Translator::TranslateRules(char *p_start, char *phonemes, int ph_size, char | |||
| if(match1.points == 0) | |||
| { | |||
| if((wc >= 0x300) && (wc <= 0x36f)) | |||
| { | |||
| // combining accent inside a word, ignore | |||
| } | |||
| else | |||
| if(IsAlpha(wc)) | |||
| { | |||
| if((any_alpha > 1) || (p[wc_bytes-1] > ' ')) | |||
| @@ -62,6 +62,10 @@ static const char *help_text = | |||
| "--compile=<voice name>\n" | |||
| "\t Compile the pronunciation rules and dictionary in the current\n" | |||
| "\t directory. =<voice name> is optional and specifies which language\n" | |||
| "--path=\"<path>\"\n" | |||
| "\t Specifies the directory containing the espeak-data directory\n" | |||
| "--phonout=\"<filename>\"\n" | |||
| "\t Write output from -x -X commands and mbrola phoneme data to this file\n" | |||
| "--punct=\"<characters>\"\n" | |||
| "\t Speak the names of punctuation characters during speaking. If\n" | |||
| "\t =<characters> is omitted, all punctuation is spoken.\n" | |||
| @@ -310,6 +314,8 @@ int main (int argc, char **argv) | |||
| {"voices", optional_argument, 0, 0x104}, | |||
| {"stdout", no_argument, 0, 0x105}, | |||
| {"split", optional_argument, 0, 0x106}, | |||
| {"path", required_argument, 0, 0x107}, | |||
| {"phonout", required_argument, 0, 0x108}, | |||
| {0, 0, 0, 0} | |||
| }; | |||
| @@ -318,6 +324,8 @@ int main (int argc, char **argv) | |||
| FILE *f_text=NULL; | |||
| char *p_text=NULL; | |||
| FILE *f_phonemes_out = stderr; | |||
| char *data_path = NULL; // use default path for espeak-data | |||
| int option_index = 0; | |||
| int c; | |||
| @@ -468,6 +476,17 @@ int main (int argc, char **argv) | |||
| samples_split = atoi(optarg); | |||
| break; | |||
| case 0x107: // --path | |||
| data_path = optarg; | |||
| break; | |||
| case 0x108: // --phonout | |||
| if((f_phonemes_out = fopen(optarg,"w")) == NULL) | |||
| { | |||
| fprintf(stderr,"Can't write to: %s\n",optarg); | |||
| } | |||
| break; | |||
| default: | |||
| exit(0); | |||
| } | |||
| @@ -477,7 +496,7 @@ int main (int argc, char **argv) | |||
| if(option_waveout || quiet) | |||
| { | |||
| // writing to a file (or no output), we can use synchronous mode | |||
| samplerate = espeak_Initialize(AUDIO_OUTPUT_SYNCHRONOUS,0,NULL,0); | |||
| samplerate = espeak_Initialize(AUDIO_OUTPUT_SYNCHRONOUS,0,data_path,0); | |||
| samples_split = (samplerate * samples_split) * 60; | |||
| espeak_SetSynthCallback(SynthCallback); | |||
| @@ -501,7 +520,7 @@ int main (int argc, char **argv) | |||
| else | |||
| { | |||
| // play the sound output | |||
| samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK,0,NULL,0); | |||
| samplerate = espeak_Initialize(AUDIO_OUTPUT_PLAYBACK,0,data_path,0); | |||
| } | |||
| @@ -538,8 +557,7 @@ int main (int argc, char **argv) | |||
| espeak_SetParameter(espeakLINELENGTH,option_linelength,0); | |||
| if(option_punctuation == 2) | |||
| espeak_SetPunctuationList(option_punctlist); | |||
| if(option_phonemes >= 0) | |||
| espeak_SetPhonemeTrace(option_phonemes,stderr); | |||
| espeak_SetPhonemeTrace(option_phonemes,f_phonemes_out); | |||
| if(filename[0]==0) | |||
| { | |||
| @@ -96,6 +96,10 @@ static const char *help_text = | |||
| "--compile=<voice name>\n" | |||
| "\t Compile the pronunciation rules and dictionary in the current\n" | |||
| "\t directory. =<voice name> is optional and specifies which language\n" | |||
| "--path=\"<path>\"\n" | |||
| "\t Specifies the directory containing the espeak-data directory\n" | |||
| "--phonout=\"<filename>\"\n" | |||
| "\t Write output from -x -X commands and mbrola phoneme data to this file\n" | |||
| "--punct=\"<characters>\"\n" | |||
| "\t Speak the names of punctuation characters during speaking. If\n" | |||
| "\t =<characters> is omitted, all punctuation is spoken.\n" | |||
| @@ -319,8 +323,15 @@ static int WavegenFile(void) | |||
| static void init_path(char *argv0) | |||
| {//=============================== | |||
| static void init_path(char *argv0, char *path_specified) | |||
| {//===================================================== | |||
| if(path_specified) | |||
| { | |||
| sprintf(path_home,"%s/espeak-data",path_specified); | |||
| return; | |||
| } | |||
| #ifdef PLATFORM_WINDOWS | |||
| HKEY RegKey; | |||
| unsigned long size; | |||
| @@ -397,9 +408,12 @@ static int initialise(void) | |||
| if((result = LoadPhData()) != 1) | |||
| { | |||
| if(result == -1) | |||
| { | |||
| fprintf(stderr,"Failed to load espeak-data\n"); | |||
| exit(1); | |||
| } | |||
| else | |||
| fprintf(stderr,"Wrong version of espeak-data 0x%x (expects 0x%x)\n",result,version_phdata); | |||
| fprintf(stderr,"Wrong version of espeak-data 0x%x (expects 0x%x) at %s\n",result,version_phdata,path_home); | |||
| } | |||
| LoadConfig(); | |||
| SetVoiceStack(NULL); | |||
| @@ -433,7 +447,8 @@ static void StopSpeak(int unused) | |||
| static int optional_argument; | |||
| static const char *arg_opts = "afklpsvw"; // which options have arguments | |||
| static char *opt_string=""; | |||
| #define no_argument 0 | |||
| #define no_argument 0 | |||
| #define required_argument 1 | |||
| #define optional_argument 2 | |||
| #endif | |||
| @@ -456,6 +471,8 @@ int main (int argc, char **argv) | |||
| {"voices", optional_argument, 0, 0x104}, | |||
| {"stdout", no_argument, 0, 0x105}, | |||
| {"split", optional_argument, 0, 0x106}, | |||
| {"path", required_argument, 0, 0x107}, | |||
| {"phonout", required_argument, 0, 0x108}, | |||
| {0, 0, 0, 0} | |||
| }; | |||
| @@ -463,6 +480,7 @@ int main (int argc, char **argv) | |||
| FILE *f_text=NULL; | |||
| const char *p_text=NULL; | |||
| char *data_path = NULL; // use default path for espeak-data | |||
| int option_index = 0; | |||
| int c; | |||
| @@ -492,9 +510,7 @@ int main (int argc, char **argv) | |||
| option_endpause = 1; | |||
| option_phoneme_input = 1; | |||
| option_multibyte = espeakCHARS_AUTO; // auto | |||
| f_trans = stdout; | |||
| init_path(argv[0]); | |||
| f_trans = stderr; | |||
| #ifdef NEED_GETOPT | |||
| optind = 1; | |||
| @@ -661,18 +677,31 @@ int main (int argc, char **argv) | |||
| DisplayVoices(stdout,optarg2); | |||
| exit(0); | |||
| case 0x106: // -- split | |||
| if(optarg2 == NULL) | |||
| samples_split = 30; // default 30 minutes | |||
| else | |||
| samples_split = atoi(optarg2); | |||
| break; | |||
| case 0x107: // --path | |||
| data_path = optarg2; | |||
| break; | |||
| case 0x108: // --phonout | |||
| if((f_trans = fopen(optarg2,"w")) == NULL) | |||
| { | |||
| fprintf(stderr,"Can't write to: %s\n",optarg2); | |||
| f_trans = stderr; | |||
| } | |||
| break; | |||
| default: | |||
| exit(0); | |||
| } | |||
| } | |||
| init_path(argv[0],data_path); | |||
| initialise(); | |||
| @@ -342,9 +342,12 @@ static int initialise(void) | |||
| if((result = LoadPhData()) != 1) | |||
| { | |||
| if(result == -1) | |||
| { | |||
| fprintf(stderr,"Failed to load espeak-data\n"); | |||
| exit(1); | |||
| } | |||
| else | |||
| fprintf(stderr,"Wrong version of espeak-data 0x%x (expects 0x%x)\n",result,version_phdata); | |||
| fprintf(stderr,"Wrong version of espeak-data 0x%x (expects 0x%x) at %s\n",result,version_phdata,path_home); | |||
| } | |||
| memset(&voice_selected,0,sizeof(voice_selected)); | |||
| @@ -1040,7 +1043,7 @@ ESPEAK_API void espeak_SetPhonemeTrace(int value, FILE *stream) | |||
| option_phonemes = value; | |||
| f_trans = stream; | |||
| if(stream == NULL) | |||
| f_trans = stdout; | |||
| f_trans = stderr; | |||
| } // end of espeak_SetPhonemes | |||
| @@ -35,7 +35,7 @@ | |||
| #include "translate.h" | |||
| #include "wave.h" | |||
| const char *version_string = "1.39.28 22.Nov.08"; | |||
| const char *version_string = "1.39.29 23.Nov.08"; | |||
| const int version_phdata = 0x013900; | |||
| int option_device_number = -1; | |||
| @@ -1514,6 +1514,7 @@ int SpeakNextClause(FILE *f_in, const void *text_in, int control) | |||
| int clause_tone; | |||
| char *voice_change; | |||
| FILE *f_mbrola; | |||
| static FILE *f_text=NULL; | |||
| static const void *p_text=NULL; | |||
| @@ -1631,7 +1632,9 @@ int SpeakNextClause(FILE *f_in, const void *text_in, int control) | |||
| #ifdef USE_MBROLA_LIB | |||
| MbrolaTranslate(phoneme_list,n_phoneme_list,NULL); | |||
| #else | |||
| MbrolaTranslate(phoneme_list,n_phoneme_list,stdout); | |||
| if((f_mbrola = f_trans) == stderr) | |||
| f_mbrola = stdout; | |||
| MbrolaTranslate(phoneme_list,n_phoneme_list,f_mbrola); | |||
| #endif | |||
| } | |||
| @@ -901,12 +901,13 @@ int PeaksToHarmspect(wavegen_peaks_t *peaks, int pitch, int *htab, int control) | |||
| } | |||
| } | |||
| // increase bass, up to the F1 peak | |||
| h=1; | |||
| for(f=pitch; f<peaks[1].freq; f+=pitch) | |||
| { | |||
| htab[h++] += (peaks[1].height * 16); | |||
| } | |||
| // increase bass, up to the F1 peak | |||
| h=1; | |||
| x = peaks[1].height * 24; | |||
| for(f=pitch; f<peaks[1].freq; f+=pitch) | |||
| { | |||
| htab[h++] += x; | |||
| } | |||
| // find the nearest harmonic for HF peaks where we don't use shape | |||
| for(; pk<N_PEAKS; pk++) | |||