sr2 = Read4Bytes(f); | sr2 = Read4Bytes(f); | ||||
fseek(f, 40, SEEK_SET); | fseek(f, 40, SEEK_SET); | ||||
if ((sr1 != samplerate_native) || (sr2 != sr1*2)) { | |||||
if (sr1 != samplerate_native) | |||||
error(ctx, "Can't resample (%d to %d): %s", sr1, samplerate_native, fname); | |||||
if ((sr1 != samplerate) || (sr2 != sr1*2)) { | |||||
if (sr1 != samplerate) | |||||
error(ctx, "Can't resample (%d to %d): %s", sr1, samplerate, fname); | |||||
else | else | ||||
error(ctx, "WAV file is not mono: %s", fname); | error(ctx, "WAV file is not mono: %s", fname); | ||||
return 0; | return 0; | ||||
sprintf(phdst, "%s", path_home); | sprintf(phdst, "%s", path_home); | ||||
} | } | ||||
samplerate_native = samplerate = rate; | |||||
samplerate = rate; | |||||
LoadPhData(NULL, NULL); | LoadPhData(NULL, NULL); | ||||
if (LoadVoice("", 8/*compiling phonemes*/) == NULL) { | if (LoadVoice("", 8/*compiling phonemes*/) == NULL) { | ||||
clean_context(ctx); | clean_context(ctx); | ||||
// write a word so that further data doesn't start at displ=0 | // write a word so that further data doesn't start at displ=0 | ||||
Write4Bytes(ctx->f_phdata, version_phdata); | Write4Bytes(ctx->f_phdata, version_phdata); | ||||
Write4Bytes(ctx->f_phdata, samplerate_native); | |||||
Write4Bytes(ctx->f_phdata, samplerate); | |||||
Write4Bytes(ctx->f_phindex, version_phdata); | Write4Bytes(ctx->f_phindex, version_phdata); | ||||
memset(ctx->ref_hash_tab, 0, sizeof(ctx->ref_hash_tab)); | memset(ctx->ref_hash_tab, 0, sizeof(ctx->ref_hash_tab)); |
mbr_name_prefix = 0; | mbr_name_prefix = 0; | ||||
if (mbrola_voice == NULL) { | if (mbrola_voice == NULL) { | ||||
samplerate = samplerate_native; | |||||
samplerate = samplerate; | |||||
SetParameter(espeakVOICETYPE, 0, 0); | SetParameter(espeakVOICETYPE, 0, 0); | ||||
return ENS_OK; | return ENS_OK; | ||||
} | } |
extern unsigned char *wavefile_data; | extern unsigned char *wavefile_data; | ||||
extern int samplerate; | extern int samplerate; | ||||
extern int samplerate_native; | |||||
#define N_ECHO_BUF 5500 // max of 250mS at 22050 Hz | #define N_ECHO_BUF 5500 // max of 250mS at 22050 Hz | ||||
extern int echo_head; | extern int echo_head; |
voice->voicing = 64; | voice->voicing = 64; | ||||
voice->consonant_amp = 90; // change from 100 to 90 for v.1.47 | voice->consonant_amp = 90; // change from 100 to 90 for v.1.47 | ||||
voice->consonant_ampv = 100; | voice->consonant_ampv = 100; | ||||
voice->samplerate = samplerate_native; | |||||
voice->samplerate = samplerate; | |||||
memset(voice->klattv, 0, sizeof(voice->klattv)); | memset(voice->klattv, 0, sizeof(voice->klattv)); | ||||
speed.fast_settings = espeakRATE_MAXIMUM; | speed.fast_settings = espeakRATE_MAXIMUM; |
static int PHASE_INC_FACTOR; | static int PHASE_INC_FACTOR; | ||||
int samplerate = 0; // this is set by Wavegeninit() | int samplerate = 0; // this is set by Wavegeninit() | ||||
int samplerate_native = 0; | |||||
static wavegen_peaks_t peaks[N_PEAKS]; | static wavegen_peaks_t peaks[N_PEAKS]; | ||||
static int peak_harmonic[N_PEAKS]; | static int peak_harmonic[N_PEAKS]; | ||||
wavemult_fact = 60; // default | wavemult_fact = 60; // default | ||||
wvoice = NULL; | wvoice = NULL; | ||||
samplerate = samplerate_native = rate; | |||||
samplerate = rate; | |||||
PHASE_INC_FACTOR = 0x8000000 / samplerate; // assumes pitch is Hz*32 | PHASE_INC_FACTOR = 0x8000000 / samplerate; // assumes pitch is Hz*32 | ||||
Flutter_inc = (64 * samplerate)/rate; | Flutter_inc = (64 * samplerate)/rate; | ||||
samplecount = 0; | samplecount = 0; |