Moves "wisper" and "croak" into voices/!v. Voice variants can now be specified as en+wisper, en+f2 (for female 2), etc. espeak --voices=variant lists the voice variants. Moves some lines from speech.h into other header files. Possible fix for data version check on big-endian. Fixed crash error iin LoadConfig(). Fixed crash in espeakedit: press Tab in enpty Prosody window. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@74 d46cf337-b52f-0410-862d-fd96e6ae7743master
_#9 t,abu:l'Ato:* | _#9 t,abu:l'Ato:* | ||||
_#32 l'e:*ts'aIC@n | _#32 l'e:*ts'aIC@n | ||||
// Not Roman numbers | |||||
v faU | |||||
x Iks | |||||
// Numbers | // Numbers | ||||
//======== | //======== |
name male1 | |||||
gender male 70 | |||||
pitch 74 109 | |||||
flutter 4 | |||||
roughness 4 | |||||
formant 0 98 95 100 | |||||
formant 1 98 95 100 | |||||
formant 2 97 95 100 | |||||
formant 3 97 100 100 | |||||
formant 4 97 100 100 | |||||
formant 5 105 100 100 | |||||
formant 6 95 100 100 | |||||
formant 7 100 100 100 | |||||
formant 8 100 100 100 | |||||
stressAdd -10 -10 -20 -20 0 0 40 70 |
gender female | |||||
pitch 140 200 | |||||
flutter 7 | |||||
roughness 4 | |||||
formant 0 115 80 150 | |||||
formant 1 120 70 187 | |||||
formant 2 110 70 150 | |||||
formant 3 115 70 150 | |||||
formant 4 110 70 150 | |||||
formant 5 110 90 150 | |||||
formant 6 105 80 150 | |||||
formant 7 110 70 150 | |||||
formant 8 110 70 150 | |||||
stressAdd -10 -10 -20 -20 0 0 40 70 |
gender female | |||||
pitch 140 220 | |||||
formant 0 105 80 150 | |||||
formant 1 110 80 160 | |||||
formant 2 110 70 150 | |||||
formant 3 110 70 150 | |||||
formant 4 115 70 150 | |||||
formant 5 115 70 150 | |||||
formant 6 110 70 150 | |||||
formant 7 110 70 150 | |||||
formant 8 110 70 150 | |||||
stressAdd 0 0 -10 -10 0 0 10 40 |
gender female | |||||
pitch 150 230 | |||||
formant 0 105 80 150 | |||||
formant 1 110 80 150 | |||||
formant 2 120 70 150 | |||||
formant 3 125 70 150 | |||||
formant 4 125 70 150 | |||||
formant 5 125 80 150 | |||||
formant 6 120 70 150 | |||||
formant 7 110 70 150 | |||||
formant 8 110 70 150 | |||||
stressAmp 18 18 20 20 20 20 20 20 | |||||
breath 0 5 7 7 7 6 6 5 |
gender female | |||||
echo 130 15 | |||||
pitch 145 200 | |||||
formant 0 120 80 150 | |||||
formant 1 115 70 160 | |||||
formant 2 125 80 150 | |||||
formant 3 125 80 150 | |||||
formant 4 125 80 150 | |||||
formant 5 125 80 150 | |||||
formant 6 110 80 150 | |||||
formant 7 110 75 150 | |||||
formant 8 110 75 150 | |||||
stressAdd -20 -20 -20 -20 0 0 60 90 | |||||
stressAmp 18 16 20 20 20 20 20 20 |
gender male | |||||
pitch 88 115 | |||||
echo 130 15 | |||||
formant 0 100 80 120 | |||||
formant 1 90 85 120 | |||||
formant 2 110 85 120 | |||||
formant 3 105 90 120 | |||||
formant 4 100 90 120 | |||||
formant 5 100 90 120 | |||||
formant 6 100 90 120 | |||||
formant 7 100 90 120 | |||||
formant 8 100 90 120 |
gender male | |||||
pitch 80 122 | |||||
formant 0 100 100 100 | |||||
formant 1 96 97 100 | |||||
formant 2 96 97 100 | |||||
formant 3 96 103 100 | |||||
formant 4 95 103 100 | |||||
formant 5 95 103 100 | |||||
formant 6 100 100 100 | |||||
formant 7 100 100 100 | |||||
formant 8 100 100 100 | |||||
stressAdd 10 10 0 0 0 0 -30 -30 |
gender male | |||||
pitch 70 110 | |||||
formant 0 103 100 100 | |||||
formant 1 103 100 100 | |||||
formant 2 103 100 100 | |||||
formant 3 103 100 100 | |||||
formant 4 106 100 100 | |||||
formant 5 106 100 100 | |||||
formant 6 106 100 100 | |||||
formant 7 103 100 100 | |||||
formant 8 103 100 100 | |||||
stressAdd -10 -10 -30 -30 0 0 60 90 |
gender male | |||||
pitch 90 130 | |||||
formant 0 100 85 130 | |||||
formant 1 105 85 130 | |||||
formant 2 105 85 130 | |||||
formant 3 105 85 130 | |||||
formant 4 105 85 130 | |||||
formant 5 105 85 130 | |||||
formant 6 105 85 150 | |||||
formant 7 105 85 150 | |||||
formant 8 105 85 150 |
gender male | |||||
pitch 82 117 | |||||
formant 0 100 90 120 | |||||
formant 1 100 90 140 | |||||
formant 2 100 70 140 | |||||
formant 3 100 75 140 | |||||
formant 4 100 80 140 | |||||
formant 5 100 80 140 | |||||
pitch 85 117 | |||||
flutter 20 | |||||
formant 0 100 80 110 | |||||
formant 1 100 100 100 | |||||
formant 2 100 100 100 | |||||
formant 3 100 100 100 | |||||
formant 4 110 100 100 | |||||
formant 5 110 100 100 | |||||
formant 6 100 100 100 | |||||
formant 7 100 100 100 | |||||
formant 8 100 100 100 | |||||
name english-wisper | |||||
language en-uk 10 | |||||
language en 10 | |||||
gender male | |||||
pitch 82 117 | |||||
formant 0 100 0 100 | |||||
formant 1 100 80 100 | |||||
flutter 20 | |||||
voicing 17 | |||||
breath 75 75 50 40 15 10 | |||||
breathw 150 150 200 200 400 400 |
phoneme t // dental variant of /t/ | phoneme t // dental variant of /t/ | ||||
vls dnt stop | vls dnt stop | ||||
vowelin f1=1 f2=1500 -300 300 f3=-100 80 amp=18 | |||||
vowelin f1=1 f2=1500 -250 250 f3=-100 80 amp=16 | |||||
vowelout f1=0 f2=1500 -300 250 f3=-100 80 rms=20 | vowelout f1=0 f2=1500 -300 250 f3=-100 80 rms=20 | ||||
lengthmod 2 | lengthmod 2 | ||||
wave ustop/t_hi%60 | wave ustop/t_hi%60 | ||||
before _ ustop/t_dnt%35 | before _ ustop/t_dnt%35 | ||||
// before _ ustop/t_hi%35 | |||||
switchvoicing d | switchvoicing d | ||||
endphoneme | endphoneme | ||||
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "main.h" | #include "main.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "voice.h" | |||||
#include "spect.h" | |||||
#include "options.h" | #include "options.h" | ||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "voice.h" | |||||
#include "spect.h" | |||||
#define tNUMBER 1 | #define tNUMBER 1 |
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "main.h" | #include "main.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "voice.h" | |||||
#include "options.h" | #include "options.h" | ||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "voice.h" | |||||
#include "spect.h" | #include "spect.h" | ||||
#include "translate.h" | #include "translate.h" | ||||
#include "prosodydisplay.h" | #include "prosodydisplay.h" |
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "main.h" | #include "main.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "voice.h" | |||||
#include "spect.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "voice.h" | |||||
#include "spect.h" | |||||
#include "translate.h" | #include "translate.h" | ||||
#include "options.h" | #include "options.h" | ||||
#include "wx/mdi.h" | #include "wx/mdi.h" | ||||
#include "speak_lib.h" | |||||
#include "main.h" | #include "main.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "phoneme.h" | |||||
#include "synthesize.h" | |||||
#include "voice.h" | #include "voice.h" | ||||
#include "spect.h" | #include "spect.h" | ||||
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "voice.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "voice.h" | |||||
#include "translate.h" | #include "translate.h" | ||||
#include "wx/wx.h" | #include "wx/wx.h" | ||||
#include "wx/fileconf.h" | #include "wx/fileconf.h" | ||||
#include "wx/filename.h" | |||||
#include <sys/stat.h> | #include <sys/stat.h> | ||||
#include "speech.h" | #include "speech.h" | ||||
if(index < 0) return; | if(index < 0) return; | ||||
p = &phlist[index]; | p = &phlist[index]; | ||||
if(p == NULL) return; | |||||
if((p == NULL) || (p->ph == NULL)) return; | |||||
sprintf(buf,"Stress %d Amp %2d LenMod %2d Pitch %3d %3d [env=%d] Flags %.2x ", | sprintf(buf,"Stress %d Amp %2d LenMod %2d Pitch %3d %3d [env=%d] Flags %.2x ", | ||||
p->tone,p->amp,p->length,p->pitch1,p->pitch2,p->env,p->ph->phflags); | p->tone,p->amp,p->length,p->pitch1,p->pitch2,p->env,p->ph->phflags); | ||||
p->length++; | p->length++; | ||||
break; | break; | ||||
case WXK_TAB: | |||||
display = 0; | |||||
event.Skip(); | |||||
transldlg->SetFocus(); | |||||
break; | |||||
default: | default: | ||||
display = 0; | |||||
event.Skip(); | event.Skip(); | ||||
break; | break; | ||||
} | } |
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "voice.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "voice.h" | |||||
#include "translate.h" | #include "translate.h" | ||||
#include <locale.h> | #include <locale.h> |
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "voice.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "voice.h" | |||||
#include "translate.h" | #include "translate.h" | ||||
extern int GetAmplitude(void); | extern int GetAmplitude(void); |
#include <sys/stat.h> | #include <sys/stat.h> | ||||
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "voice.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "voice.h" | |||||
#include "translate.h" | #include "translate.h" | ||||
#endif | #endif | ||||
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "voice.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "voice.h" | |||||
#include "translate.h" | #include "translate.h" | ||||
#include "debug.h" | #include "debug.h" | ||||
char *Alloc(int size) | char *Alloc(int size) | ||||
{//================== | {//================== | ||||
char *p; | char *p; | ||||
if((p = (char *)malloc(size+1)) == NULL) | |||||
if((p = (char *)malloc(size)) == NULL) | |||||
fprintf(stderr,"Can't allocate memory\n"); // I was told that size+1 fixes a crash on 64-bit systems | fprintf(stderr,"Can't allocate memory\n"); // I was told that size+1 fixes a crash on 64-bit systems | ||||
return(p); | return(p); | ||||
} | } |
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "main.h" | #include "main.h" | ||||
#include "voice.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "voice.h" | |||||
#include "spect.h" | #include "spect.h" | ||||
#include "options.h" | #include "options.h" | ||||
#include "wx/txtstrm.h" | #include "wx/txtstrm.h" |
#include <ctype.h> | #include <ctype.h> | ||||
#include "main.h" | |||||
#include "speak_lib.h" | |||||
#include "speech.h" | #include "speech.h" | ||||
#include "main.h" | |||||
#include "phoneme.h" | |||||
#include "synthesize.h" | |||||
#include "voice.h" | #include "voice.h" | ||||
#include "spect.h" | #include "spect.h" | ||||
#include "options.h" | #include "options.h" |
#include "wx/wx.h" | #include "wx/wx.h" | ||||
#include <math.h> | #include <math.h> | ||||
#include "speak_lib.h" | |||||
#include "speech.h" | #include "speech.h" | ||||
#include "phoneme.h" | |||||
#include "synthesize.h" | |||||
#include "voice.h" | #include "voice.h" | ||||
#include "spect.h" | #include "spect.h" | ||||
#include "main.h" | #include "main.h" |
#define N_PEAKS 9 | |||||
#define N_MARKERS 8 | |||||
typedef struct { | typedef struct { | ||||
const char *mnem; | const char *mnem; | ||||
int LookupMnem(MNEM_TAB *table, char *string); | int LookupMnem(MNEM_TAB *table, char *string); | ||||
typedef struct { | |||||
short pkfreq; | |||||
short pkheight; | |||||
short pkwidth; | |||||
short pkright; | |||||
} peak_t; | |||||
typedef struct { | |||||
short frflags; | |||||
unsigned char length; | |||||
unsigned char rms; | |||||
short ffreq[9]; | |||||
unsigned char fheight[9]; | |||||
unsigned char fwidth[6]; // width/4 | |||||
unsigned char fright[6]; // width/4 | |||||
} frame_t; | |||||
int GetFileLength(const char *filename); | |||||
char *Alloc(int size); | |||||
void Free(void *ptr); | |||||
#define N_PATH_HOME 120 | #define N_PATH_HOME 120 | ||||
extern char path_home[N_PATH_HOME]; // this is the espeak-data directory | extern char path_home[N_PATH_HOME]; // this is the espeak-data directory | ||||
extern const char *version_string; | |||||
extern const int version_phdata; | |||||
extern void strncpy0(char *to,const char *from, int size); | extern void strncpy0(char *to,const char *from, int size); | ||||
int GetFileLength(const char *filename); | |||||
char *Alloc(int size); | |||||
void Free(void *ptr); | |||||
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "voice.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "voice.h" | |||||
#include "translate.h" | #include "translate.h" | ||||
#include "wave.h" | #include "wave.h" | ||||
const char *version_string = "1.28.04 15.Aug.07"; | |||||
const char *version_string = "1.28.05 17.Aug.07"; | |||||
const int version_phdata = 0x012801; | const int version_phdata = 0x012801; | ||||
int option_device_number = -1; | int option_device_number = -1; | ||||
return(-1); | return(-1); | ||||
wavefile_data = (unsigned char *)spects_data; | wavefile_data = (unsigned char *)spects_data; | ||||
version = *((unsigned int *)spects_data); | |||||
// read the version number from the first 4 bytes of phondata | |||||
version = 0; | |||||
for(ix=0; ix<4; ix++) | |||||
{ | |||||
version += (wavefile_data[ix] << (ix*8)); | |||||
} | |||||
if(version != version_phdata) | if(version != version_phdata) | ||||
{ | { | ||||
result = version; | result = version; | ||||
if(ix==2) | if(ix==2) | ||||
{ | { | ||||
soundicon_tab[n_soundicon_tab].name = c1; | soundicon_tab[n_soundicon_tab].name = c1; | ||||
p = Alloc(strlen(string+1)); | |||||
p = Alloc(strlen(string)+1); | |||||
strcpy(p,string); | strcpy(p,string); | ||||
soundicon_tab[n_soundicon_tab].filename = p; | soundicon_tab[n_soundicon_tab].filename = p; | ||||
soundicon_tab[n_soundicon_tab++].length = 0; | soundicon_tab[n_soundicon_tab++].length = 0; |
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "voice.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "voice.h" | |||||
#include "translate.h" | #include "translate.h" | ||||
#define PITCHfall 0 | #define PITCHfall 0 |
extern int embedded_default[N_EMBEDDED_VALUES]; | extern int embedded_default[N_EMBEDDED_VALUES]; | ||||
#define N_PEAKS 9 | |||||
#define N_MARKERS 8 | |||||
typedef struct { | |||||
short pkfreq; | |||||
short pkheight; | |||||
short pkwidth; | |||||
short pkright; | |||||
} peak_t; | |||||
typedef struct { | |||||
short frflags; | |||||
unsigned char length; | |||||
unsigned char rms; | |||||
short ffreq[9]; | |||||
unsigned char fheight[9]; | |||||
unsigned char fwidth[6]; // width/4 | |||||
unsigned char fright[6]; // width/4 | |||||
} frame_t; | |||||
// formant data used by wavegen | // formant data used by wavegen | ||||
typedef struct { | typedef struct { | ||||
int freq; // Hz<<16 | int freq; // Hz<<16 | ||||
extern espeak_EVENT *event_list; | extern espeak_EVENT *event_list; | ||||
extern t_espeak_callback* synth_callback; | extern t_espeak_callback* synth_callback; | ||||
extern int option_log_frames; | extern int option_log_frames; | ||||
extern const char *version_string; | |||||
extern const int version_phdata; | |||||
#define N_SOUNDICON_TAB 100 | #define N_SOUNDICON_TAB 100 | ||||
extern int n_soundicon_tab; | extern int n_soundicon_tab; |
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "voice.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "voice.h" | |||||
#include "translate.h" | #include "translate.h" | ||||
#define WORD_STRESS_CHAR '*' | #define WORD_STRESS_CHAR '*' |
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "voice.h" | |||||
#include "main.h" | #include "main.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "voice.h" | |||||
#include "translate.h" | #include "translate.h" | ||||
#include "prosodydisplay.h" | #include "prosodydisplay.h" | ||||
#include "wx/wx.h" | #include "wx/wx.h" | ||||
#include "speak_lib.h" | |||||
#include "main.h" | #include "main.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "phoneme.h" | |||||
#include "synthesize.h" | |||||
#include "voice.h" | #include "voice.h" | ||||
#include "spect.h" | #include "spect.h" | ||||
#include "options.h" | #include "options.h" |
#endif | #endif | ||||
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "voice.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "voice.h" | |||||
#include "translate.h" | #include "translate.h" | ||||
if(n_languages == 0) | if(n_languages == 0) | ||||
{ | { | ||||
#ifdef deleted | |||||
// Read voice variant files | |||||
// Don't use this, instead preset the variants_* arrays | |||||
// no language is specified, this voice file only affects the voice characteristics | |||||
if(memcmp(leafname,"!variant",8)==0) | |||||
{ | |||||
if(((variant = atoi(&leafname[8])) > 0) && (strlen(variants_either) < N_VOICE_VARIANTS)) | |||||
{ | |||||
char string[2]; | |||||
string[0] = variant; | |||||
string[1] = 0; | |||||
strcat(variants_either,string); | |||||
if(gender == 1) | |||||
strcat(variants_male,string); | |||||
if(gender == 2) | |||||
strcat(variants_female,string); | |||||
} | |||||
} | |||||
#endif | |||||
return(NULL); // no language lines in the voice file | return(NULL); // no language lines in the voice file | ||||
} | } | ||||
static voice_t *VoiceLookup(char *voicename) | static voice_t *VoiceLookup(char *voicename) | ||||
{//========================================= | {//========================================= | ||||
// Keep a cache of previously used voices. | |||||
int ix; | int ix; | ||||
voice_t *v; | voice_t *v; | ||||
for(ix=0; ix < N_VOICES; ix++) | for(ix=0; ix < N_VOICES; ix++) | ||||
{ | { | ||||
if((ix < n_voices_tab) && (strcmp(voices_tab[ix]->name,voicename)==0)) | |||||
{ | |||||
return(voices_tab[ix]); // found the entry for the specified voice name | |||||
} | |||||
if(ix == n_voices_tab) | if(ix == n_voices_tab) | ||||
{ | { | ||||
// found a free slot | // found a free slot | ||||
strncpy0(v->name,voicename,sizeof(v->name)); | strncpy0(v->name,voicename,sizeof(v->name)); | ||||
return(v); | return(v); | ||||
} | } | ||||
else | |||||
if(strcmp(voices_tab[ix]->name,voicename)==0) | |||||
{ | |||||
return(voices_tab[ix]); // found the entry for the specified voice name | |||||
} | |||||
} | } | ||||
return(NULL); // table is full | |||||
return(voices_tab[0]); // table is full, reuse the first entry | |||||
} // end of VoiceLookup | } // end of VoiceLookup | ||||
break; | break; | ||||
sscanf(p,"%s",language_name); | sscanf(p,"%s",language_name); | ||||
if(strcmp(language_name,"variant")==0) | |||||
break; | |||||
language_type = strtok(language_name,"-"); | language_type = strtok(language_name,"-"); | ||||
language_set = 1; | language_set = 1; | ||||
strcpy(translator_name,language_type); | strcpy(translator_name,language_type); | ||||
} // end of LoadVoice | } // end of LoadVoice | ||||
voice_t *LoadVoiceVariant(const char *vname, int variant) | |||||
{//====================================================== | |||||
voice_t *v; | |||||
char *ExtractVoiceVariantName(char *vname, int variant_num) | |||||
{//======================================================== | |||||
// Remove any voice variant suffix (name or number) from a voice name | |||||
// Returns the voice variant name | |||||
char *p; | char *p; | ||||
char buf[40]; | |||||
static char variant_name[20]; | |||||
variant_name[0] = 0; | |||||
strcpy(buf,vname); | |||||
if((p = strchr(buf,'+')) != NULL) | |||||
if((p = strchr(vname,'+')) != NULL) | |||||
{ | { | ||||
// The voice name has a +variant suffix | // The voice name has a +variant suffix | ||||
*p = 0; | |||||
variant = atoi(p+1); | |||||
*p++ = 0; // delete the suffix from the voice name | |||||
if(isdigit(*p)) | |||||
{ | |||||
variant_num = atoi(p); // variant number | |||||
} | |||||
else | |||||
{ | |||||
// voice variant name, not number | |||||
strcpy(variant_name,"!v/"); | |||||
strncpy0(&variant_name[3],p,sizeof(variant_name)-3); | |||||
} | |||||
} | |||||
if(variant_num > 0) | |||||
{ | |||||
if(variant_num < 10) | |||||
sprintf(variant_name,"!v/m%d",variant_num); // male | |||||
else | |||||
sprintf(variant_name,"!v/f%d",variant_num-10); // female | |||||
} | } | ||||
v = LoadVoice(buf,0); | |||||
if((v != NULL) && (variant > 0)) | |||||
return(variant_name); | |||||
} // end of ExtractVoiceVariantName | |||||
voice_t *LoadVoiceVariant(const char *vname, int variant_num) | |||||
{//========================================================== | |||||
// Load a voice file. | |||||
// Also apply a voice variant if specified by "variant", or by "+number" or "+name" in the "vname" | |||||
voice_t *v; | |||||
char *variant_name; | |||||
char buf[60]; | |||||
strncpy0(buf,vname,sizeof(buf)); | |||||
variant_name = ExtractVoiceVariantName(buf,variant_num); | |||||
if((v = LoadVoice(buf,0)) == NULL) | |||||
return(NULL); | |||||
if(variant_name[0] != 0) | |||||
{ | { | ||||
sprintf(buf,"!varnt%d",variant); // changed from !variant1 to !varnt1 to avoid 8 char filenames on DOS | |||||
v = LoadVoice(buf,2); | |||||
v = LoadVoice(variant_name,2); | |||||
} | } | ||||
return(v); | return(v); | ||||
} | } | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
if((*p == 0) && (strcmp(voice_spec->languages,"variants")==0)) | |||||
{ | |||||
// match on a voice with no languages if the required language is "variants" | |||||
score = 100; | |||||
} | |||||
// compare the required language with each of the languages of this voice | // compare the required language with each of the languages of this voice | ||||
while(*p != 0) | while(*p != 0) | ||||
{ | { | ||||
HANDLE hFind = INVALID_HANDLE_VALUE; | HANDLE hFind = INVALID_HANDLE_VALUE; | ||||
DWORD dwError; | DWORD dwError; | ||||
#undef UNICODE // we need FindFirstFileA() which takes an 8-bit c-string | |||||
sprintf(fname,"%s\\*",path); | sprintf(fname,"%s\\*",path); | ||||
hFind = FindFirstFile(fname, &FindFileData); | hFind = FindFirstFile(fname, &FindFileData); | ||||
if(hFind == INVALID_HANDLE_VALUE) | if(hFind == INVALID_HANDLE_VALUE) | ||||
{//========================================= | {//========================================= | ||||
espeak_VOICE *v; | espeak_VOICE *v; | ||||
espeak_VOICE voice_selector; | espeak_VOICE voice_selector; | ||||
int variant=0; | |||||
char *p; | |||||
char variant_name[20]; | |||||
char *variant_name; | |||||
static char buf[60]; | static char buf[60]; | ||||
strncpy0(buf,name,sizeof(buf)); | strncpy0(buf,name,sizeof(buf)); | ||||
if((p = strchr(buf,'+')) != NULL) | |||||
{ | |||||
// remove the voice variant suffix, from eg. en+3 | |||||
*p = 0; | |||||
variant = atoi(p+1); | |||||
} | |||||
variant_name = ExtractVoiceVariantName(buf,0); | |||||
memset(&voice_selector,0,sizeof(voice_selector)); | memset(&voice_selector,0,sizeof(voice_selector)); | ||||
voice_selector.name = (char *)name; | |||||
voice_selector.name = buf; | |||||
// first check for a voice with this filename | // first check for a voice with this filename | ||||
// This may avoid the need to call espeak_ListVoices(). | // This may avoid the need to call espeak_ListVoices(). | ||||
{ | { | ||||
voice_selected = first_voice; | voice_selected = first_voice; | ||||
if(variant > 0) | |||||
if(variant_name[0] != 0) | |||||
{ | { | ||||
// apply a voice variant | |||||
sprintf(variant_name,"!varnt%d",variant); | |||||
LoadVoice(variant_name,2); | LoadVoice(variant_name,2); | ||||
} | } | ||||
if((v = SelectVoiceByName(voices_list,buf)) != NULL) | if((v = SelectVoiceByName(voices_list,buf)) != NULL) | ||||
{ | { | ||||
if(LoadVoiceVariant(v->identifier,variant) != NULL) | |||||
if(LoadVoice(v->identifier,0) != NULL) | |||||
{ | { | ||||
voice_selected = v; | voice_selected = v; | ||||
if(variant_name[0] != 0) | |||||
{ | |||||
LoadVoice(variant_name,2); | |||||
} | |||||
WavegenSetVoice(voice); | WavegenSetVoice(voice); | ||||
SetVoiceStack(&voice_selector); | SetVoiceStack(&voice_selector); | ||||
return(EE_OK); | return(EE_OK); |
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "main.h" | #include "main.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "voice.h" | |||||
#include "spect.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "voice.h" | |||||
#include "spect.h" | |||||
#include "translate.h" | #include "translate.h" | ||||
#include "options.h" | #include "options.h" | ||||
#include "speak_lib.h" | #include "speak_lib.h" | ||||
#include "speech.h" | #include "speech.h" | ||||
#include "voice.h" | |||||
#include "phoneme.h" | #include "phoneme.h" | ||||
#include "synthesize.h" | #include "synthesize.h" | ||||
#include "voice.h" | |||||
#ifdef USE_PORTAUDIO | #ifdef USE_PORTAUDIO | ||||
#include "portaudio.h" | #include "portaudio.h" |
# PROP Use_Debug_Libraries 1 | # PROP Use_Debug_Libraries 1 | ||||
# PROP Output_Dir "vc_mswud" | # PROP Output_Dir "vc_mswud" | ||||
# PROP Intermediate_Dir "vc_mswud\minimal" | # PROP Intermediate_Dir "vc_mswud\minimal" | ||||
# PROP Ignore_Export_Lib 0 | |||||
# PROP Target_Dir "" | # PROP Target_Dir "" | ||||
# ADD BASE CPP /nologo /MDd /W4 /Gm /GR /Zi /Od /I ".\..\..\lib\vc_lib\mswud" /I ".\..\..\include" /I "." /I ".\..\..\samples" /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "_WINDOWS" /D "NOPCH" /Fd"vc_mswud\minimal.pdb" /FD /GZ /EHsc /c | # ADD BASE CPP /nologo /MDd /W4 /Gm /GR /Zi /Od /I ".\..\..\lib\vc_lib\mswud" /I ".\..\..\include" /I "." /I ".\..\..\samples" /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "_WINDOWS" /D "NOPCH" /Fd"vc_mswud\minimal.pdb" /FD /GZ /EHsc /c | ||||
# ADD CPP /nologo /MDd /W4 /Gm /GR /Zi /Od /I ".\..\..\lib\vc_lib\mswud" /I ".\..\..\include" /I "." /I ".\..\..\samples" /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "_WINDOWS" /D "NOPCH" /Fd"vc_mswud\minimal.pdb" /FD /GZ /EHsc /c | # ADD CPP /nologo /MDd /W4 /Gm /GR /Zi /Od /I ".\..\..\lib\vc_lib\mswud" /I ".\..\..\include" /I "." /I ".\..\..\samples" /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "_WINDOWS" /D "NOPCH" /Fd"vc_mswud\minimal.pdb" /FD /GZ /EHsc /c | ||||
# ADD BSC32 /nologo | # ADD BSC32 /nologo | ||||
LINK32=link.exe | LINK32=link.exe | ||||
# ADD BASE LINK32 wxmsw28ud_core.lib wxbase28ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib odbc32.lib /nologo /subsystem:windows /debug /machine:I386 /libpath:".\..\..\lib\vc_lib" | # ADD BASE LINK32 wxmsw28ud_core.lib wxbase28ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib odbc32.lib /nologo /subsystem:windows /debug /machine:I386 /libpath:".\..\..\lib\vc_lib" | ||||
# ADD LINK32 wxmsw28ud_core.lib wxbase28ud.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib odbc32.lib /nologo /subsystem:windows /debug /machine:I386 /libpath:".\..\..\lib\vc_lib" | |||||
# ADD LINK32 wxmsw28ud_core.lib wxbase28ud.lib wxmsw28ud_adv.lib winmm.lib PAStaticWMME.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexud.lib wxexpatd.lib PAStaticWMME.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib odbc32.lib /nologo /subsystem:windows /debug /machine:I386 /libpath:".\..\..\lib\vc_lib" | |||||
!ELSEIF "$(CFG)" == "minimal - Win32 Release" | !ELSEIF "$(CFG)" == "minimal - Win32 Release" | ||||
#define LOG_FRAMES // write keyframe info to src/log | #define LOG_FRAMES // write keyframe info to src/log | ||||
#define N_PEAKS 9 | |||||
#define N_MARKERS 8 | |||||
// comment this out when compiling the "speak" process | // comment this out when compiling the "speak" process | ||||
//#define SPECT_EDITOR | //#define SPECT_EDITOR | ||||
typedef unsigned char UCHAR; | typedef unsigned char UCHAR; | ||||
typedef double DOUBLEX; | typedef double DOUBLEX; | ||||
typedef struct { | typedef struct { | ||||
const char *mnem; | const char *mnem; | ||||
int value; | int value; | ||||
int LookupMnem(MNEM_TAB *table, char *string); | int LookupMnem(MNEM_TAB *table, char *string); | ||||
typedef struct { | |||||
short pkfreq; | |||||
short pkheight; | |||||
short pkwidth; | |||||
short pkright; | |||||
} peak_t; | |||||
typedef struct { | |||||
short frflags; | |||||
unsigned char length; | |||||
unsigned char rms; | |||||
short ffreq[9]; | |||||
unsigned char fheight[9]; | |||||
unsigned char fwidth[6]; // width/4 | |||||
unsigned char fright[6]; // width/4 | |||||
} frame_t; | |||||
#define N_PATH_HOME 120 | |||||
extern char path_home[N_PATH_HOME]; // this is the espeak-data directory | |||||
extern void strncpy0(char *to,const char *from, int size); | |||||
int GetFileLength(const char *filename); | int GetFileLength(const char *filename); | ||||
char *Alloc(int size); | char *Alloc(int size); | ||||
void Free(void *ptr); | void Free(void *ptr); | ||||
#define N_PATH_HOME 120 | |||||
extern char path_home[N_PATH_HOME]; // this is the espeak-data directory | |||||
extern const char *version_string; | |||||
extern const int version_phdata; | |||||
extern void strncpy0(char *to,const char *from, int size); |
#define LOG_FRAMES // write keyframe info to src/log | #define LOG_FRAMES // write keyframe info to src/log | ||||
#define N_PEAKS 9 | |||||
#define N_MARKERS 8 | |||||
// comment this out when compiling the "speak" process | // comment this out when compiling the "speak" process | ||||
//#define SPECT_EDITOR | //#define SPECT_EDITOR | ||||
typedef unsigned char UCHAR; | typedef unsigned char UCHAR; | ||||
typedef double DOUBLEX; | typedef double DOUBLEX; | ||||
typedef struct { | typedef struct { | ||||
const char *mnem; | const char *mnem; | ||||
int value; | int value; | ||||
int LookupMnem(MNEM_TAB *table, char *string); | int LookupMnem(MNEM_TAB *table, char *string); | ||||
typedef struct { | |||||
short pkfreq; | |||||
short pkheight; | |||||
short pkwidth; | |||||
short pkright; | |||||
} peak_t; | |||||
typedef struct { | |||||
short frflags; | |||||
unsigned char length; | |||||
unsigned char rms; | |||||
short ffreq[9]; | |||||
unsigned char fheight[9]; | |||||
unsigned char fwidth[6]; // width/4 | |||||
unsigned char fright[6]; // width/4 | |||||
} frame_t; | |||||
#define N_PATH_HOME 120 | |||||
extern char path_home[N_PATH_HOME]; // this is the espeak-data directory | |||||
extern void strncpy0(char *to,const char *from, int size); | |||||
int GetFileLength(const char *filename); | int GetFileLength(const char *filename); | ||||
char *Alloc(int size); | char *Alloc(int size); | ||||
void Free(void *ptr); | void Free(void *ptr); | ||||
#define N_PATH_HOME 120 | |||||
extern char path_home[N_PATH_HOME]; // this is the espeak-data directory | |||||
extern const char *version_string; | |||||
extern const int version_phdata; | |||||
extern void strncpy0(char *to,const char *from, int size); |
#define N_PEAKS 9 | |||||
#define N_MARKERS 7 | |||||
typedef struct { | typedef struct { | ||||
const char *mnem; | const char *mnem; | ||||
int LookupMnem(MNEM_TAB *table, char *string); | int LookupMnem(MNEM_TAB *table, char *string); | ||||
typedef struct { | |||||
short pkfreq; | |||||
short pkheight; | |||||
short pkwidth; | |||||
short pkright; | |||||
} peak_t; | |||||
typedef struct { | |||||
short frflags; | |||||
unsigned char length; | |||||
unsigned char rms; | |||||
short ffreq[9]; | |||||
unsigned char fheight[9]; | |||||
unsigned char fwidth[6]; // width/4 | |||||
unsigned char fright[6]; // width/4 | |||||
} frame_t; | |||||
int GetFileLength(const char *filename); | |||||
char *Alloc(int size); | |||||
void Free(void *ptr); | |||||
#define N_PATH_HOME 120 | #define N_PATH_HOME 120 | ||||
extern char path_home[N_PATH_HOME]; // this is the espeak-data directory | extern char path_home[N_PATH_HOME]; // this is the espeak-data directory | ||||
extern const char *version_string; | |||||
extern const int version_phdata; | |||||
extern void strncpy0(char *to,const char *from, int size); | extern void strncpy0(char *to,const char *from, int size); | ||||
int GetFileLength(const char *filename); | |||||
char *Alloc(int size); | |||||
void Free(void *ptr); | |||||
#define N_PEAKS 9 | |||||
#define N_MARKERS 7 | |||||
typedef struct { | typedef struct { | ||||
const char *mnem; | const char *mnem; | ||||
int LookupMnem(MNEM_TAB *table, char *string); | int LookupMnem(MNEM_TAB *table, char *string); | ||||
typedef struct { | |||||
short pkfreq; | |||||
short pkheight; | |||||
short pkwidth; | |||||
short pkright; | |||||
} peak_t; | |||||
typedef struct { | |||||
short frflags; | |||||
unsigned char length; | |||||
unsigned char rms; | |||||
short ffreq[9]; | |||||
unsigned char fheight[9]; | |||||
unsigned char fwidth[6]; // width/4 | |||||
unsigned char fright[6]; // width/4 | |||||
} frame_t; | |||||
int GetFileLength(const char *filename); | |||||
char *Alloc(int size); | |||||
void Free(void *ptr); | |||||
#define N_PATH_HOME 120 | #define N_PATH_HOME 120 | ||||
extern char path_home[N_PATH_HOME]; // this is the espeak-data directory | extern char path_home[N_PATH_HOME]; // this is the espeak-data directory | ||||
extern const char *version_string; | |||||
extern const int version_phdata; | |||||
extern void strncpy0(char *to,const char *from, int size); | extern void strncpy0(char *to,const char *from, int size); | ||||
int GetFileLength(const char *filename); | |||||
char *Alloc(int size); | |||||
void Free(void *ptr); | |||||
#define N_PEAKS 9 | |||||
#define N_MARKERS 7 | |||||
typedef struct { | typedef struct { | ||||
const char *mnem; | const char *mnem; | ||||
int LookupMnem(MNEM_TAB *table, char *string); | int LookupMnem(MNEM_TAB *table, char *string); | ||||
typedef struct { | |||||
short pkfreq; | |||||
short pkheight; | |||||
short pkwidth; | |||||
short pkright; | |||||
} peak_t; | |||||
typedef struct { | |||||
short frflags; | |||||
unsigned char length; | |||||
unsigned char rms; | |||||
short ffreq[9]; | |||||
unsigned char fheight[9]; | |||||
unsigned char fwidth[6]; // width/4 | |||||
unsigned char fright[6]; // width/4 | |||||
} frame_t; | |||||
int GetFileLength(const char *filename); | |||||
char *Alloc(int size); | |||||
void Free(void *ptr); | |||||
#define N_PATH_HOME 120 | #define N_PATH_HOME 120 | ||||
extern char path_home[N_PATH_HOME]; // this is the espeak-data directory | extern char path_home[N_PATH_HOME]; // this is the espeak-data directory | ||||
extern const char *version_string; | |||||
extern const int version_phdata; | |||||
extern void strncpy0(char *to,const char *from, int size); | extern void strncpy0(char *to,const char *from, int size); | ||||
int GetFileLength(const char *filename); | |||||
char *Alloc(int size); | |||||
void Free(void *ptr); | |||||