diff --git a/phsource/envelope/p_211 b/phsource/envelope/p_211 deleted file mode 100644 index 1153e96b..00000000 Binary files a/phsource/envelope/p_211 and /dev/null differ diff --git a/phsource/envelope/p_214 b/phsource/envelope/p_214 deleted file mode 100644 index d59f0bf7..00000000 Binary files a/phsource/envelope/p_214 and /dev/null differ diff --git a/phsource/envelope/p_fall b/phsource/envelope/p_fall deleted file mode 100644 index 0e8d0228..00000000 Binary files a/phsource/envelope/p_fall and /dev/null differ diff --git a/phsource/envelope/p_fallrise b/phsource/envelope/p_fallrise deleted file mode 100644 index c0da66d3..00000000 Binary files a/phsource/envelope/p_fallrise and /dev/null differ diff --git a/phsource/envelope/p_level b/phsource/envelope/p_level deleted file mode 100644 index f937f61e..00000000 Binary files a/phsource/envelope/p_level and /dev/null differ diff --git a/phsource/envelope/p_rise b/phsource/envelope/p_rise deleted file mode 100644 index 120b21f7..00000000 Binary files a/phsource/envelope/p_rise and /dev/null differ diff --git a/phsource/envelope/vi_2 b/phsource/envelope/vi_2 deleted file mode 100644 index cca3620c..00000000 Binary files a/phsource/envelope/vi_2 and /dev/null differ diff --git a/phsource/envelope/vi_5 b/phsource/envelope/vi_5 deleted file mode 100644 index bad96f07..00000000 Binary files a/phsource/envelope/vi_5 and /dev/null differ diff --git a/phsource/envelope/vi_5amp b/phsource/envelope/vi_5amp deleted file mode 100644 index 0ec02021..00000000 Binary files a/phsource/envelope/vi_5amp and /dev/null differ diff --git a/phsource/envelope/vi_6 b/phsource/envelope/vi_6 deleted file mode 100644 index 5d29dcfe..00000000 Binary files a/phsource/envelope/vi_6 and /dev/null differ diff --git a/phsource/envelope/vi_6amp b/phsource/envelope/vi_6amp deleted file mode 100644 index 086aac05..00000000 Binary files a/phsource/envelope/vi_6amp and /dev/null differ diff --git a/platforms/windows/windows_cmd/espeak.dsp b/platforms/windows/windows_cmd/espeak.dsp index 381b02cf..99ff63ff 100755 --- a/platforms/windows/windows_cmd/espeak.dsp +++ b/platforms/windows/windows_cmd/espeak.dsp @@ -73,7 +73,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib winmm.lib user32.lib gdi32.lib winspool.lib comdlg32.lib PAStaticWMME.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept !ENDIF diff --git a/src/compiledata.cpp b/src/compiledata.cpp index ef90cb14..53174961 100755 --- a/src/compiledata.cpp +++ b/src/compiledata.cpp @@ -75,6 +75,7 @@ extern void Write4Bytes(FILE *f, int value); extern void MakeVowelLists(void); extern void FindPhonemesUsed(void); +extern void DrawEnvelopes(); extern int CompileDictionary(const char *dsource, const char *dict_name, FILE *log, char *fname); extern char voice_name[]; @@ -91,6 +92,14 @@ typedef struct { } REF_HASH_TAB; +#define N_ENVELOPES 30 +#define ENV_LEN 128 +int n_envelopes = 0; +char envelope_paths[N_ENVELOPES][80]; +unsigned char envelope_dat[N_ENVELOPES][ENV_LEN]; + + + class Compile {//========== public: @@ -119,6 +128,7 @@ private: int LoadSpect(const char *path, int control); int LoadWavefile(FILE *f, const char *fname); int LoadEnvelope(FILE *f, const char *fname); + int LoadEnvelope2(FILE *f, const char *fname); int LoadDataFile(const char *path, int control); int AddSpect(int phcode, int *list, int control); void AddSpectList(int *list, int control); @@ -879,6 +889,13 @@ int Compile::LoadEnvelope(FILE *f, const char *fname) fread(buf,1,128,f); fwrite(buf,1,128,f_phdata); + if(n_envelopes < N_ENVELOPES) + { + strncpy0(envelope_paths[n_envelopes],fname,sizeof(envelope_paths[0])); + memcpy(envelope_dat[n_envelopes],buf,sizeof(envelope_dat[0])); + n_envelopes++; + } + return(displ); } @@ -971,6 +988,12 @@ int Compile::LoadDataFile(const char *path, int control) type_code = 'E'; } else + if(id == 0x45564E45) + { + ix = LoadEnvelope2(f,path); + type_code = 'E'; + } + else { Error("File not SPEC or RIFF",path); ix = -1; @@ -979,7 +1002,6 @@ int Compile::LoadDataFile(const char *path, int control) if(ix > 0) { -// fprintf(f_phcontents,"%c %-15s %4d 0x%.5x %s\n",type_code,current_fname,linenum,ix & 0x7fffff,path); fprintf(f_phcontents,"%c 0x%.5x %s\n",type_code,ix & 0x7fffff,path); } @@ -1808,6 +1830,67 @@ void make_envs() } #endif +int Compile::LoadEnvelope2(FILE *f, const char *fname) +{//=================================================== + int ix; + int n; + int x, y; + int displ; + int n_points; + char line_buf[128]; + float env_x[20]; + float env_y[20]; + int env_lin[20]; + unsigned char env[ENV_LEN]; + + n_points = 0; + fgets(line_buf,sizeof(line_buf),f); // skip first line + while(!feof(f)) + { + if(fgets(line_buf,sizeof(line_buf),f) == NULL) + break; + + env_lin[n_points] = 0; + n = sscanf(line_buf,"%f %f %d",&env_x[n_points],&env_y[n_points],&env_lin[n_points]); + if(n >= 2) + { + env_x[n_points] *= 1.28; // convert range 0-100 to 0-128 + n_points++; + } + } + env_x[n_points] = env_x[n_points-1]; + env_y[n_points] = env_y[n_points-1]; + + ix = -1; + for(x=0; x env_x[ix+4]) + ix++; + + if(n_points > 3) + y = (int)(polint(&env_x[ix],&env_y[ix],4,x) * 2.55); // convert to range 0-255 + else + y = (int)(polint(&env_x[ix],&env_y[ix],3,x) * 2.55); + if(y < 0) y = 0; + if(y > 255) y = 255; + env[x] = y; + } + + + if(n_envelopes < N_ENVELOPES) + { + strncpy0(envelope_paths[n_envelopes],fname,sizeof(envelope_paths[0])); + memcpy(envelope_dat[n_envelopes],env,ENV_LEN); + n_envelopes++; + } + + displ = ftell(f_phdata); + fwrite(env,1,128,f_phdata); + + return(displ); +} + + static int ref_sorter(char **a, char **b) {//====================================== @@ -2081,6 +2164,7 @@ void Compile::CPhonemeTab(const char *source) make_envs(); #endif + n_envelopes = 0; error_count = 0; memset(markers_used,0,sizeof(markers_used)); @@ -2192,7 +2276,7 @@ fprintf(f_errors,"Refs %d, Reused %d\n",count_references,duplicate_references); LoadPhData(); LoadVoice(voice_name,0); Report(); - + DrawEnvelopes(); report_dict = CompileAllDictionaries(); diff --git a/src/synthdata.cpp b/src/synthdata.cpp index 0f7ca186..d8652ad0 100755 --- a/src/synthdata.cpp +++ b/src/synthdata.cpp @@ -35,7 +35,7 @@ #include "translate.h" #include "wave.h" -const char *version_string = "1.28.05 17.Aug.07"; +const char *version_string = "1.28.07 21.Aug.07"; const int version_phdata = 0x012801; int option_device_number = -1; diff --git a/src/vowelchart.cpp b/src/vowelchart.cpp index 39ee1e0b..2a7baf47 100644 --- a/src/vowelchart.cpp +++ b/src/vowelchart.cpp @@ -506,3 +506,55 @@ void MakeVowelLists(void) LoadVoice(voice_name,0); // reset the original phoneme table delete progress; } + + +extern int n_envelopes; +extern char envelope_paths[][80]; +extern unsigned char envelope_dat[][128]; + +#define HT_ENV 140 +#define WD_ENV 128*2 + +void DrawEnvelopes() +{//================ + int ix_env; + int y_base; + int x; + unsigned char *env; + char name[80]; + + wxBitmap bitmap(WD_ENV,HT_ENV*n_envelopes); + + // Create a memory DC + wxMemoryDC dc; + dc.SelectObject(bitmap); + dc.SetBrush(*wxWHITE_BRUSH); + dc.SetFont(*wxSWISS_FONT); + dc.Clear(); + + + for(ix_env=0; ix_env