mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-11 08:30:31 +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:
+266
-102
@@ -34,71 +34,97 @@ extern int GetAmplitude(void);
|
||||
|
||||
|
||||
// convert from words-per-minute to internal speed factor
|
||||
static unsigned char speed_lookup[290] = {
|
||||
250, 246, 243, 239, 236, // 80
|
||||
233, 229, 226, 223, 220, // 85
|
||||
217, 214, 211, 208, 205, // 90
|
||||
202, 197, 194, 192, 190, // 95
|
||||
187, 185, 183, 180, 178, // 100
|
||||
176, 174, 172, 170, 168, // 105
|
||||
166, 164, 161, 159, 158, // 110
|
||||
156, 154, 152, 150, 148, // 115
|
||||
146, 145, 143, 141, 137, // 120
|
||||
136, 135, 133, 132, 131, // 125
|
||||
129, 128, 127, 126, 125, // 130
|
||||
124, 122, 121, 120, 119, // 135
|
||||
117, 116, 115, 114, 113, // 140
|
||||
112, 111, 110, 108, 107, // 145
|
||||
106, 105, 104, 103, 102, // 150
|
||||
101, 100, 99, 98, 97, // 155
|
||||
96, 95, 93, 92, 92, // 160
|
||||
91, 90, 89, 89, 88, // 165
|
||||
87, 87, 86, 85, 85, // 170
|
||||
84, 83, 83, 82, 81, // 175
|
||||
80, 80, 79, 78, 78, // 180
|
||||
77, 76, 76, 75, 73, // 185
|
||||
72, 72, 71, 71, 70, // 190
|
||||
70, 69, 69, 68, 67, // 195
|
||||
67, 66, 66, 65, 65, // 200
|
||||
64, 64, 63, 63, 62, // 205
|
||||
62, 61, 60, 60, 59, // 210
|
||||
59, 58, 58, 57, 57, // 215
|
||||
56, 56, 55, 55, 55, // 220
|
||||
54, 54, 53, 53, 52, // 225
|
||||
52, 51, 51, 50, 50, // 230
|
||||
49, 49, 49, 48, 48, // 235
|
||||
47, 47, 46, 46, 46, // 240
|
||||
45, 45, 44, 44, 43, // 245
|
||||
43, 43, 42, 42, 41, // 250
|
||||
41, 41, 40, 40, 39, // 255
|
||||
39, 39, 38, 38, 38, // 260
|
||||
37, 37, 37, 36, 36, // 265
|
||||
35, 35, 35, 34, 34, // 270
|
||||
34, 33, 33, 33, 32, // 275
|
||||
32, 32, 32, 31, 31, // 280
|
||||
31, 30, 30, 30, 29, // 285
|
||||
29, 29, 29, 28, 28, // 290
|
||||
28, 28, 27, 27, 27, // 295
|
||||
26, 26, 26, 26, 25, // 300
|
||||
25, 25, 22, 22, 22, // 305
|
||||
22, 22, 22, 22, 22, // 310
|
||||
21, 21, 21, 21, 21, // 315
|
||||
21, 20, 20, 20, 20, // 320
|
||||
20, 15, 15, 15, 15, // 325
|
||||
15, 15, 15, 15, 16, // 330
|
||||
16, 16, 16, 15, 15, // 335
|
||||
15, 15, 15, 15, 15, // 340
|
||||
15, 17, 17, 16, 16, // 345
|
||||
15, 15, 14, 14, 13, // 350
|
||||
13, 12, 12, 11, 11, // 355
|
||||
10, 10, 9, 8, 8, // 360
|
||||
7, 6, 5, 5, 4, // 365
|
||||
// Use this to calibrate speed for wpm 80-350
|
||||
static unsigned char speed_lookup[] = {
|
||||
255, 255, 255, 255, 255, // 80
|
||||
253, 249, 245, 242, 238, // 85
|
||||
235, 232, 228, 225, 222, // 90
|
||||
218, 216, 213, 210, 207, // 95
|
||||
204, 201, 198, 196, 193, // 100
|
||||
191, 188, 186, 183, 181, // 105
|
||||
179, 176, 174, 172, 169, // 110
|
||||
168, 165, 163, 161, 159, // 115
|
||||
158, 155, 153, 152, 150, // 120
|
||||
148, 146, 145, 143, 141, // 125
|
||||
139, 137, 136, 135, 133, // 130
|
||||
131, 130, 129, 127, 126, // 135
|
||||
124, 123, 122, 120, 119, // 140
|
||||
118, 117, 115, 114, 113, // 145
|
||||
112, 111, 110, 109, 107, // 150
|
||||
106, 105, 104, 103, 102, // 155
|
||||
101, 100, 99, 98, 97, // 160
|
||||
96, 95, 94, 93, 92, // 165
|
||||
91, 90, 89, 89, 88, // 170
|
||||
87, 86, 85, 84, 83, // 175
|
||||
82, 82, 81, 80, 80, // 180
|
||||
79, 78, 77, 76, 76, // 185
|
||||
75, 75, 74, 73, 72, // 190
|
||||
71, 71, 70, 69, 69, // 195
|
||||
68, 67, 67, 66, 66, // 200
|
||||
65, 64, 64, 63, 62, // 205
|
||||
62, 61, 61, 60, 59, // 210
|
||||
59, 58, 58, 57, 57, // 215
|
||||
56, 56, 55, 54, 54, // 220
|
||||
53, 53, 52, 52, 52, // 225
|
||||
51, 50, 50, 49, 49, // 230
|
||||
48, 48, 47, 47, 46, // 235
|
||||
46, 46, 45, 45, 44, // 240
|
||||
44, 44, 43, 43, 42, // 245
|
||||
41, 40, 40, 40, 39, // 250
|
||||
39, 39, 38, 38, 38, // 255
|
||||
37, 37, 37, 36, 36, // 260
|
||||
35, 35, 35, 35, 34, // 265
|
||||
34, 34, 33, 33, 33, // 270
|
||||
32, 32, 31, 31, 31, // 275
|
||||
30, 30, 30, 29, 29, // 280
|
||||
29, 29, 28, 28, 27, // 285
|
||||
27, 27, 27, 26, 26, // 290
|
||||
26, 26, 25, 25, 25, // 295
|
||||
24, 24, 24, 24, 23, // 300
|
||||
23, 23, 23, 22, 22, // 305
|
||||
22, 21, 21, 21, 21, // 310
|
||||
20, 20, 20, 20, 19, // 315
|
||||
19, 19, 18, 18, 17, // 320
|
||||
17, 17, 16, 16, 16, // 325
|
||||
16, 16, 16, 15, 15, // 330
|
||||
15, 15, 14, 14, 14, // 335
|
||||
13, 13, 13, 12, 12, // 340
|
||||
12, 12, 11, 11, 11, // 345
|
||||
11, 10, 10, 10, 9, // 350
|
||||
9, 9, 8, 8, 8, // 355
|
||||
};
|
||||
|
||||
// speed_factor2 adjustments for speeds 370 to 390
|
||||
static unsigned char faster[] = {
|
||||
114,112,110,109,107,105,104,102,100,98, // 370-379
|
||||
96,94,92,90,88,85,83,80,78,75,72 }; //380-390
|
||||
|
||||
// speed_factor1 adjustments for speeds 350 to 374: pauses
|
||||
static unsigned char pause_factor_350[] = {
|
||||
22,22,22,22,22,22,22,21,21,21, // 350
|
||||
21,20,20,19,19,18,17,16,15,15, // 360
|
||||
15,15,15,15,15}; // 370
|
||||
|
||||
// wav_factor adjustments for speeds 350 to 450
|
||||
// Use this to calibrate speed for wpm 350-450
|
||||
static unsigned char wav_factor_350[] = {
|
||||
120, 121, 120, 119, 119, // 350
|
||||
118, 118, 117, 116, 116, // 355
|
||||
115, 114, 113, 112, 112, // 360
|
||||
111, 111, 110, 109, 108, // 365
|
||||
107, 106, 106, 104, 103, // 370
|
||||
103, 102, 102, 102, 101, // 375
|
||||
101, 99, 98, 98, 97, // 380
|
||||
96, 96, 95, 94, 93, // 385
|
||||
91, 90, 91, 90, 89, // 390
|
||||
88, 86, 85, 86, 85, // 395
|
||||
85, 84, 82, 81, 80, // 400
|
||||
79, 77, 78, 78, 76, // 405
|
||||
77, 75, 75, 74, 73, // 410
|
||||
71, 72, 70, 69, 69, // 415
|
||||
69, 67, 65, 64, 63, // 420
|
||||
63, 63, 61, 61, 59, // 425
|
||||
59, 59, 58, 56, 57, // 430
|
||||
58, 56, 54, 53, 52, // 435
|
||||
52, 53, 52, 52, 50, // 440
|
||||
48, 47, 47, 45, 46, // 445
|
||||
45}; // 450
|
||||
|
||||
static int speed1 = 130;
|
||||
static int speed2 = 121;
|
||||
@@ -106,27 +132,92 @@ static int speed3 = 118;
|
||||
|
||||
|
||||
|
||||
//#define TEST_SPEED
|
||||
|
||||
void SetSpeed(int control)
|
||||
{//=======================
|
||||
int x;
|
||||
int s1;
|
||||
int wpm;
|
||||
int wpm2;
|
||||
int test=0;
|
||||
|
||||
speed.loud_consonants = 0;
|
||||
speed.min_sample_len = 450;
|
||||
speed.lenmod_factor = 110; // controls the effect of FRFLAG_LEN_MOD reduce length change
|
||||
speed.lenmod2_factor = 100;
|
||||
|
||||
wpm = embedded_value[EMBED_S];
|
||||
if(control == 2)
|
||||
wpm = embedded_value[EMBED_S2];
|
||||
|
||||
#ifdef TEST_SPEED
|
||||
if(wpm > 1000)
|
||||
{
|
||||
// TESTING
|
||||
test = wpm / 1000;
|
||||
wpm = wpm % 1000;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(voice->speed_percent > 0)
|
||||
{
|
||||
wpm = (wpm * voice->speed_percent)/100;
|
||||
}
|
||||
if(wpm > 450)
|
||||
wpm = 450;
|
||||
|
||||
if(wpm > 360)
|
||||
{
|
||||
speed.loud_consonants = (wpm - 360) / 8;
|
||||
}
|
||||
|
||||
#ifdef deleted
|
||||
if(wpm >= 450)
|
||||
{
|
||||
// TEST
|
||||
speed1 = 6;
|
||||
speed2 = speed3 = 5;
|
||||
speed.pause_factor = 12;
|
||||
speed.clause_pause_factor = 15;
|
||||
speed.wav_factor = 70;
|
||||
speed.lenmod_factor = 53;
|
||||
speed.min_sample_len = 400;
|
||||
return;
|
||||
}
|
||||
if(wpm > 390)
|
||||
{
|
||||
// TEST
|
||||
speed1 = 6;
|
||||
speed2 = speed3 = 5;
|
||||
speed.pause_factor = 13;
|
||||
speed.clause_pause_factor = 15;
|
||||
|
||||
if(wpm >= 440)
|
||||
{
|
||||
speed.wav_factor = 72 - (wpm - 440)/4;
|
||||
speed.lenmod_factor = 60 - (wpm - 440)/2;
|
||||
speed.min_sample_len = 420 - (wpm - 440);
|
||||
}
|
||||
else
|
||||
{
|
||||
speed.wav_factor = 74;
|
||||
speed.lenmod_factor = 65 - (wpm - 400)/10;
|
||||
speed.min_sample_len = 450 - (wpm - 400)/2;
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
wpm2 = wpm;
|
||||
if(wpm > 359) wpm2 = 359;
|
||||
if(wpm < 80) wpm2 = 80;
|
||||
x = speed_lookup[wpm2-80];
|
||||
|
||||
if(wpm > 369) wpm = 369;
|
||||
if(wpm < 80) wpm = 80;
|
||||
|
||||
x = speed_lookup[wpm-80];
|
||||
if(wpm >= 380)
|
||||
x = 7;
|
||||
if(wpm >= 400)
|
||||
x = 6;
|
||||
|
||||
if(control & 1)
|
||||
{
|
||||
@@ -135,43 +226,101 @@ void SetSpeed(int control)
|
||||
speed1 = (x * voice->speedf1)/256;
|
||||
speed2 = (x * voice->speedf2)/256;
|
||||
speed3 = (x * voice->speedf3)/256;
|
||||
|
||||
if(x <= 7)
|
||||
{
|
||||
speed1 = x;
|
||||
speed2 = speed3 = x - 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(control & 2)
|
||||
{
|
||||
// these are used in synthesis file
|
||||
s1 = (x * voice->speedf1)/256;
|
||||
speed.speed_factor1 = (256 * s1)/115; // full speed adjustment, used for pause length
|
||||
if(speed.speed_factor1 < 15)
|
||||
speed.speed_factor1 = 15;
|
||||
if(wpm >= 170)
|
||||
// speed_factor2 = 100 + (166*s1)/128; // reduced speed adjustment, used for playing recorded sounds
|
||||
speed.speed_factor2 = 110 + (150*s1)/128; // reduced speed adjustment, used for playing recorded sounds
|
||||
else
|
||||
speed.speed_factor2 = 128 + (128*s1)/130; // = 215 at 170 wpm
|
||||
|
||||
if(wpm2 > 369)
|
||||
if(wpm > 350)
|
||||
{
|
||||
if(wpm2 > 390)
|
||||
wpm2 = 390;
|
||||
speed.speed_factor2 = faster[wpm2 - 370];
|
||||
speed.lenmod_factor = 85 - (wpm - 350) / 3;
|
||||
speed.lenmod2_factor = 60 - (wpm - 350) / 8;
|
||||
}
|
||||
else
|
||||
if(wpm > 250)
|
||||
{
|
||||
speed.lenmod_factor = 110 - (wpm - 250)/4;
|
||||
speed.lenmod2_factor = 110 - (wpm - 250)/2;
|
||||
}
|
||||
|
||||
s1 = (x * voice->speedf1)/256;
|
||||
|
||||
if(wpm >= 170)
|
||||
speed.wav_factor = 110 + (150*s1)/128; // reduced speed adjustment, used for playing recorded sounds
|
||||
else
|
||||
speed.wav_factor = 128 + (128*s1)/130; // = 215 at 170 wpm
|
||||
|
||||
if(wpm >= 350)
|
||||
{
|
||||
speed.wav_factor = wav_factor_350[wpm-350];
|
||||
}
|
||||
|
||||
if(wpm >= 390)
|
||||
{
|
||||
speed.min_sample_len = 450 - (wpm - 400)/2;
|
||||
if(wpm > 440)
|
||||
speed.min_sample_len = 420 - (wpm - 440);
|
||||
}
|
||||
|
||||
if(test > 0)
|
||||
speed.wav_factor = test;
|
||||
|
||||
speed.pause_factor = (256 * s1)/115; // full speed adjustment, used for pause length
|
||||
speed.clause_pause_factor = 0;
|
||||
|
||||
if(wpm > 430)
|
||||
{
|
||||
speed.pause_factor = 12;
|
||||
// speed.clause_pause_factor = 15;
|
||||
}
|
||||
else
|
||||
if(wpm > 400)
|
||||
{
|
||||
speed.pause_factor = 13;
|
||||
// speed.clause_pause_factor = 15;
|
||||
}
|
||||
else
|
||||
if(wpm > 374)
|
||||
{
|
||||
speed.pause_factor = 14;
|
||||
}
|
||||
else
|
||||
if(wpm > 350)
|
||||
{
|
||||
speed.pause_factor = pause_factor_350[wpm - 350];
|
||||
}
|
||||
|
||||
if(speed.clause_pause_factor == 0)
|
||||
{
|
||||
// restrict the reduction of pauses between clauses
|
||||
if((speed.clause_pause_factor = speed.pause_factor) < 16)
|
||||
speed.clause_pause_factor = 16;
|
||||
}
|
||||
|
||||
if(wpm >= 370)
|
||||
{
|
||||
// TESTING
|
||||
// use experimental fast settings if they have been specified in the Voice
|
||||
if(speed.fast_settings[0] > 0)
|
||||
speed.pause_factor = speed.fast_settings[0];
|
||||
if(speed.fast_settings[1] > 0)
|
||||
speed.wav_factor = speed.fast_settings[1];
|
||||
if(speed.fast_settings[2] > 0)
|
||||
speed.lenmod_factor = speed.lenmod2_factor = speed.fast_settings[2];
|
||||
}
|
||||
}
|
||||
|
||||
speed.min_sample_len = 450;
|
||||
speed.speed_factor3 = 110; // controls the effect of FRFLAG_LEN_MOD reduce length change
|
||||
|
||||
if(wpm2 >= 370)
|
||||
{
|
||||
// TESTING
|
||||
// use experimental fast settings if they have been specified in the Voice
|
||||
if(speed.fast_settings[0] > 0)
|
||||
speed.speed_factor1 = speed.fast_settings[0];
|
||||
if(speed.fast_settings[1] > 0)
|
||||
speed.speed_factor2 = speed.fast_settings[1];
|
||||
if(speed.fast_settings[2] > 0)
|
||||
speed.speed_factor3 = speed.fast_settings[2];
|
||||
}
|
||||
#ifdef TEST_SPEED
|
||||
//if(control==3)
|
||||
printf("%3d: speedf %d %d %d pause=%d %d wav=%d lenmod=%d %d\n",wpm,speed1,speed2,speed3, speed.pause_factor,speed.clause_pause_factor, speed.wav_factor,speed.lenmod_factor,speed.lenmod2_factor);
|
||||
#endif
|
||||
} // end of SetSpeed
|
||||
|
||||
|
||||
@@ -349,13 +498,17 @@ void CalcLengths(Translator *tr)
|
||||
break;
|
||||
|
||||
case phVFRICATIVE:
|
||||
if(next->type==phVOWEL)
|
||||
{
|
||||
pre_voiced = 1;
|
||||
} // drop through
|
||||
case phFRICATIVE:
|
||||
if(p->newword)
|
||||
p->prepause = 15;
|
||||
{
|
||||
if((prev->type == phVOWEL) && (p->ph->phflags & phNOPAUSE))
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
p->prepause = 15;
|
||||
}
|
||||
}
|
||||
|
||||
if(next->type==phPAUSE && prev->type==phNASAL && !(p->ph->phflags&phFORTIS))
|
||||
p->prepause = 25;
|
||||
@@ -363,6 +516,9 @@ void CalcLengths(Translator *tr)
|
||||
if(prev->ph->phflags & phBRKAFTER)
|
||||
p->prepause = 30;
|
||||
|
||||
if((tr->langopts.word_gap & 0x10) && (p->newword))
|
||||
p->prepause = 30;
|
||||
|
||||
if((p->ph->phflags & phSIBILANT) && next->type==phSTOP && !next->newword)
|
||||
{
|
||||
if(prev->type == phVOWEL)
|
||||
@@ -373,9 +529,17 @@ void CalcLengths(Translator *tr)
|
||||
else
|
||||
p->length = 256;
|
||||
|
||||
if((tr->langopts.word_gap & 0x10) && (p->newword))
|
||||
p->prepause = 30;
|
||||
|
||||
if(type == phVFRICATIVE)
|
||||
{
|
||||
if(next->type==phVOWEL)
|
||||
{
|
||||
pre_voiced = 1;
|
||||
}
|
||||
if((prev->type==phVOWEL) || (prev->type == phLIQUID))
|
||||
{
|
||||
p->length = (255 + prev->length)/2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case phVSTOP:
|
||||
|
||||
Reference in New Issue
Block a user