mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-23 20:14:23 +00:00
[1.43.46]
Fix: Speak punctuation option also caused text after [[ to be spoken as phoneme codes even if espeakPHONEMES flag is not set. Speak sequences of letters and dots as individual letters, and don't speak 'dot', eg. "u.s.a." Don't announce punctuation in the alternative text inside <audio ... </audio> Vowelcharts, show the positions of multiple FMT() in vowel phonemes definitions. Phoneme definitions: New attributes: flag1, flag2, flag3 New attribute: nopause. Prevents the insertion of a short pause when this phoneme starts a word which follows a vowel. New conditions: isFlag1, isFlag2, isFlag3, isSibilant. New statement: InsertPhoneme() Phonemes: improve syllablic [m-] [n-] [N-] *_rules: add attributes $p_alt .. $p_alt3, $w_alt .. $w_alt3 *_list: add attributes: $sentence, $atstart klatt synthesizer: implement echo. espeakedit, Prosody display: Indicate stressed and secondary-stress syllables. espeakedit: remember window size and position. Intonation: New file, 'phsource/intonation' to define 'tunes' which can be used from voice files. espeakedit: add Compile -> Intonationm data Speed: Increase range to 80 to 450, with default=175. Improve speaking at high speeds. lang=en: Reduce consecutive unstressed syllables to 'diminished' stress, only in unstressed words. lang=de: Change 'r' phoneme. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@244 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+85
-37
@@ -190,9 +190,14 @@ int PauseLength(int pause, int control)
|
||||
int len;
|
||||
|
||||
if(control == 0)
|
||||
len = (pause * speed.speed_factor1)/256;
|
||||
{
|
||||
if(pause >= 200)
|
||||
len = (pause * speed.clause_pause_factor)/256;
|
||||
else
|
||||
len = (pause * speed.pause_factor)/256;
|
||||
}
|
||||
else
|
||||
len = (pause * speed.speed_factor2)/256;
|
||||
len = (pause * speed.wav_factor)/256;
|
||||
|
||||
if(len < 5) len = 5; // mS, limit the amount to which pauses can be shortened
|
||||
return(len);
|
||||
@@ -204,9 +209,14 @@ static void DoPause(int length, int control)
|
||||
// control = 1, less shortening at fast speeds
|
||||
int len;
|
||||
|
||||
len = PauseLength(length, control);
|
||||
if(length == 0)
|
||||
len = 0;
|
||||
else
|
||||
{
|
||||
len = PauseLength(length, control);
|
||||
|
||||
len = (len * samplerate) / 1000; // convert from mS to number of samples
|
||||
len = (len * samplerate) / 1000; // convert from mS to number of samples
|
||||
}
|
||||
|
||||
EndPitch(1);
|
||||
wcmdq[wcmdq_tail][0] = WCMD_PAUSE;
|
||||
@@ -223,7 +233,7 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
{//=============================================================================================
|
||||
int length;
|
||||
int wav_length;
|
||||
int format;
|
||||
int wav_scale;
|
||||
int min_length;
|
||||
int x;
|
||||
int len4;
|
||||
@@ -232,18 +242,26 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
|
||||
index = index & 0x7fffff;
|
||||
p = &wavefile_data[index];
|
||||
format = p[2];
|
||||
wav_scale = p[2];
|
||||
wav_length = (p[1] * 256);
|
||||
wav_length += p[0]; // length in bytes
|
||||
|
||||
min_length = speed.min_sample_len;
|
||||
if(format==0)
|
||||
min_length *= 2;
|
||||
|
||||
if(wav_scale==0)
|
||||
min_length *= 2; // 16 bit samples
|
||||
else
|
||||
{
|
||||
// increase consonant amplitude at high speeds, depending on the peak consonant amplitude
|
||||
x = ((35 - wav_scale) * speed.loud_consonants);
|
||||
if(x < 0) x = 0;
|
||||
wav_scale = (wav_scale * (x+256))/256;
|
||||
}
|
||||
|
||||
if(std_length > 0)
|
||||
{
|
||||
std_length = (std_length * samplerate)/1000;
|
||||
if(format == 0)
|
||||
if(wav_scale == 0)
|
||||
std_length *= 2;
|
||||
|
||||
x = (min_length * std_length)/wav_length;
|
||||
@@ -261,7 +279,7 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
std_length = (std_length * length_mod)/256;
|
||||
}
|
||||
|
||||
length = (std_length * speed.speed_factor2)/256;
|
||||
length = (std_length * speed.wav_factor)/256;
|
||||
|
||||
if(control & pd_DONTLENGTHEN)
|
||||
{
|
||||
@@ -283,7 +301,7 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
length = min_length;
|
||||
|
||||
|
||||
if(format == 0)
|
||||
if(wav_scale == 0)
|
||||
{
|
||||
// 16 bit samples
|
||||
length /= 2;
|
||||
@@ -305,7 +323,7 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
q[0] = WCMD_WAVE2;
|
||||
q[1] = length | (wav_length << 16); // length in samples
|
||||
q[2] = long(&wavefile_data[index]);
|
||||
q[3] = format + (amp << 8);
|
||||
q[3] = wav_scale + (amp << 8);
|
||||
WcmdqInc();
|
||||
return(length);
|
||||
}
|
||||
@@ -326,14 +344,14 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
q[0] = WCMD_WAVE;
|
||||
q[1] = x; // length in samples
|
||||
q[2] = long(&wavefile_data[index]);
|
||||
q[3] = format + (amp << 8);
|
||||
q[3] = wav_scale + (amp << 8);
|
||||
WcmdqInc();
|
||||
|
||||
|
||||
while(length > len4*3)
|
||||
{
|
||||
x = len4;
|
||||
if(format == 0)
|
||||
if(wav_scale == 0)
|
||||
x *= 2;
|
||||
|
||||
last_wcmdq = wcmdq_tail;
|
||||
@@ -341,7 +359,7 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
q[0] = WCMD_WAVE;
|
||||
q[1] = len4*2; // length in samples
|
||||
q[2] = long(&wavefile_data[index+x]);
|
||||
q[3] = format + (amp << 8);
|
||||
q[3] = wav_scale + (amp << 8);
|
||||
WcmdqInc();
|
||||
|
||||
length -= len4*2;
|
||||
@@ -350,14 +368,14 @@ static int DoSample2(int index, int which, int std_length, int control, int leng
|
||||
if(length > 0)
|
||||
{
|
||||
x = wav_length - length;
|
||||
if(format == 0)
|
||||
if(wav_scale == 0)
|
||||
x *= 2;
|
||||
last_wcmdq = wcmdq_tail;
|
||||
q = wcmdq[wcmdq_tail];
|
||||
q[0] = WCMD_WAVE;
|
||||
q[1] = length; // length in samples
|
||||
q[2] = long(&wavefile_data[index+x]);
|
||||
q[3] = format + (amp << 8);
|
||||
q[3] = wav_scale + (amp << 8);
|
||||
WcmdqInc();
|
||||
}
|
||||
|
||||
@@ -662,8 +680,8 @@ static short vcolouring[N_VCOLOUR][5] = {
|
||||
seq[0].length = VOWEL_FRONT_LENGTH;
|
||||
if(len > 0)
|
||||
seq[0].length = len;
|
||||
seq[0].frflags |= FRFLAG_LEN_MOD; // reduce length modification
|
||||
fr->frflags |= FRFLAG_LEN_MOD;
|
||||
seq[0].frflags |= FRFLAG_LEN_MOD2; // reduce length modification
|
||||
fr->frflags |= FRFLAG_LEN_MOD2;
|
||||
|
||||
next_rms = seq[1].frame->rms;
|
||||
|
||||
@@ -994,13 +1012,14 @@ int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_L
|
||||
long *q;
|
||||
int len;
|
||||
int frame_length;
|
||||
int frame1_length;
|
||||
int frame2_length;
|
||||
int length_factor;
|
||||
int length_mod;
|
||||
int length_sum;
|
||||
int length_min;
|
||||
int total_len = 0;
|
||||
static int wave_flag = 0;
|
||||
int wcmd_spect = WCMD_SPECT;
|
||||
int frame_lengths[N_SEQ_FRAMES];
|
||||
|
||||
if(fmt_params->fmt_addr == 0)
|
||||
return(0);
|
||||
@@ -1008,6 +1027,13 @@ int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_L
|
||||
length_mod = plist->length;
|
||||
if(length_mod==0) length_mod=256;
|
||||
|
||||
length_min = (samplerate/70); // greater than one cycle at low pitch (Hz)
|
||||
if(which==2)
|
||||
{
|
||||
if((translator->langopts.param[LOPT_LONG_VOWEL_THRESHOLD] > 0) && ((this_ph->std_length >= translator->langopts.param[LOPT_LONG_VOWEL_THRESHOLD]) || (plist->synthflags & SFLAG_LENGTHEN) || (this_ph->phflags & phLONG)))
|
||||
length_min *= 2; // ensure long vowels are longer
|
||||
}
|
||||
|
||||
if(which==1)
|
||||
{
|
||||
// limit the shortening of sonorants before shortened (eg. unstressed vowels)
|
||||
@@ -1026,14 +1052,16 @@ if(which==1)
|
||||
return(0); // not found
|
||||
|
||||
frame1 = frames[0].frame;
|
||||
frame1_length = frames[0].length;
|
||||
if(voice->klattv[0])
|
||||
wcmd_spect = WCMD_KLATT;
|
||||
|
||||
wavefile_ix = fmt_params->wav_addr;
|
||||
wavefile_amp = (fmt_params->wav_amp * 32)/100;
|
||||
if(wavefile_amp == 0)
|
||||
|
||||
if(fmt_params->wav_amp == 0)
|
||||
wavefile_amp = 32;
|
||||
else
|
||||
wavefile_amp = (fmt_params->wav_amp * 32)/100;
|
||||
|
||||
if(wavefile_ix == 0)
|
||||
{
|
||||
if(wave_flag)
|
||||
@@ -1083,11 +1111,39 @@ if(which==1)
|
||||
syllable_centre = wcmdq_tail;
|
||||
}
|
||||
|
||||
frame_length = frame1_length;
|
||||
length_sum = 0;
|
||||
for(frameix=1; frameix < n_frames; frameix++)
|
||||
{
|
||||
length_factor = length_mod;
|
||||
if(frames[frameix-1].frflags & FRFLAG_LEN_MOD) // reduce effect of length mod
|
||||
{
|
||||
length_factor = (length_mod*(256-speed.lenmod_factor) + 256*speed.lenmod_factor)/256;
|
||||
}
|
||||
else
|
||||
if(frames[frameix-1].frflags & FRFLAG_LEN_MOD2) // reduce effect of length mod, used for the start of a vowel
|
||||
{
|
||||
length_factor = (length_mod*(256-speed.lenmod2_factor) + 256*speed.lenmod2_factor)/256;
|
||||
}
|
||||
|
||||
frame_length = frames[frameix-1].length;
|
||||
len = (frame_length * samplerate)/1000;
|
||||
len = (len * length_factor)/256;
|
||||
length_sum += len;
|
||||
frame_lengths[frameix] = len;
|
||||
}
|
||||
|
||||
if((length_sum > 0) && (length_sum < length_min))
|
||||
{
|
||||
// lengthen, so that the sequence is greater than one cycle at low pitch
|
||||
for(frameix=1; frameix < n_frames; frameix++)
|
||||
{
|
||||
frame_lengths[frameix] = (frame_lengths[frameix] * length_min) / length_sum;
|
||||
}
|
||||
}
|
||||
|
||||
for(frameix=1; frameix<n_frames; frameix++)
|
||||
{
|
||||
frame2 = frames[frameix].frame;
|
||||
frame2_length = frames[frameix].length;
|
||||
|
||||
if((fmt_params->wav_addr != 0) && ((frame1->frflags & FRFLAG_DEFER_WAV)==0))
|
||||
{
|
||||
@@ -1099,14 +1155,6 @@ if(which==1)
|
||||
fmt_params->wav_addr = 0;
|
||||
}
|
||||
|
||||
length_factor = length_mod;
|
||||
if(frame1->frflags & FRFLAG_LEN_MOD) // reduce effect of length mod
|
||||
{
|
||||
length_factor = (length_mod*(256-speed.speed_factor3) + 256*speed.speed_factor3)/256;
|
||||
}
|
||||
len = (frame_length * samplerate)/1000;
|
||||
len = (len * length_factor)/256;
|
||||
|
||||
if(modulation >= 0)
|
||||
{
|
||||
if(frame1->frflags & FRFLAG_MODULATE)
|
||||
@@ -1117,13 +1165,13 @@ if(which==1)
|
||||
modulation |= modn_flags; // before or after a glottal stop
|
||||
}
|
||||
|
||||
len = frame_lengths[frameix];
|
||||
pitch_length += len;
|
||||
amp_length += len;
|
||||
|
||||
if(frame_length < 2)
|
||||
if(len == 0)
|
||||
{
|
||||
last_frame = NULL;
|
||||
frame_length = frame2_length;
|
||||
frame1 = frame2;
|
||||
}
|
||||
else
|
||||
@@ -1141,7 +1189,6 @@ if(which==1)
|
||||
WcmdqInc();
|
||||
}
|
||||
last_frame = frame1 = frame2;
|
||||
frame_length = frame2_length;
|
||||
total_len += len;
|
||||
}
|
||||
}
|
||||
@@ -1280,6 +1327,7 @@ int Generate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
|
||||
syllable_centre = -1;
|
||||
last_pitch_cmd = -1;
|
||||
memset(vowel_transition,0,sizeof(vowel_transition));
|
||||
DoPause(0,0); // isolate from the previous clause
|
||||
}
|
||||
|
||||
while(ix < (*n_ph))
|
||||
|
||||
Reference in New Issue
Block a user