Fix agc, not applied correctly when echo is set. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@91 d46cf337-b52f-0410-862d-fd96e6ae7743master
| @@ -2710,6 +2710,7 @@ | |||
| ie (ntal I'E | |||
| g) ie (n i: | |||
| _sc) ie (n aI@ | |||
| ?8 _sc) ie (n aIa2 | |||
| ie (nCiA I2'E | |||
| fr) ie (nd E | |||
| f) ie (nd i: | |||
| @@ -27,12 +27,12 @@ | |||
| hierar) ch (i C | |||
| me) ch (a C | |||
| te) ch (n C | |||
| _pe) ch C | |||
| pszi) ch C | |||
| pszy) ch C | |||
| mün) ch (en C | |||
| maso) ch (istA C | |||
| monar) ch (i C | |||
| _pe) ch C | |||
| szé) ch tS | |||
| _zi) ch (y tS | |||
| @@ -224,6 +224,7 @@ _munká) s S | |||
| _nyílá) s S | |||
| _o) slo slo: | |||
| _o) sló slo: | |||
| tojá) s S | |||
| sz (öld Sz | |||
| va) s (zabl S|| | |||
| @@ -299,6 +300,7 @@ vörösmar) ty ti | |||
| má) zc (sz z | |||
| mé) zc (sz z | |||
| nehé) z (sé z | |||
| pén) z z | |||
| szá) z (sz z | |||
| tű) z (sz z | |||
| ví) z (sz z | |||
| @@ -276,6 +276,7 @@ | |||
| 3 vdiph/0i_2 en_sc no en_wi | |||
| 3 vdiph2/e@ en_sc en_wi | |||
| 1 vdiph2/ea ro | |||
| 1 vdiph2/ei_3 en_wm | |||
| 1 vdiph2/eo ro | |||
| 1 vdiph2/e[u ro | |||
| 1 vdiph2/i@ en_n | |||
| @@ -414,8 +415,8 @@ | |||
| 1 vowel/@- base | |||
| 4 vowel/& en_rp fi hi sv | |||
| 4 vowel/0 base2 en hi pt | |||
| 4 vowel/0_2 en_n en_wm pt_pt sw | |||
| 4 vowel/0_3 en_us en_sc en_rp hu | |||
| 3 vowel/0_2 en_n pt_pt sw | |||
| 5 vowel/0_3 en_us en_sc en_rp en_wm hu | |||
| 2 vowel/@_2 fr | |||
| 2 vowel/&_2 en_us | |||
| 6 vowel/@_3 en_sc de hi | |||
| @@ -444,14 +445,14 @@ | |||
| 2 vowel/aa_8 en_us | |||
| 3 vowel/a_en en fr | |||
| 1 vowel/@_bck hi | |||
| 16 vowel/e base2 en en_n af cy eo fr hr it la pt pt_pt ++ | |||
| 17 vowel/e base2 en en_n en_wm af cy eo fr hr it la pt ++ | |||
| 2 vowel/e# en_sc | |||
| 7 vowel/e_2 en_sc de hi it sv no | |||
| 1 vowel/e_3 hu | |||
| 1 vowel/e_5 en_sc | |||
| 3 vowel/ee fr pl sv | |||
| 2 vowel/e_e en_sc is | |||
| 9 vowel/ee_1 base2 en en_n en_wm pl la sv no zhy | |||
| 8 vowel/ee_1 base2 en en_n pl la sv no zhy | |||
| 4 vowel/ee_2 en en_us cy nl | |||
| 1 vowel/ee#_2 sv | |||
| 4 vowel/ee_3 af pt vi | |||
| @@ -567,7 +568,6 @@ | |||
| 1 vwl_en_us/oor en_us | |||
| 3 vwl_en_us/or en_us en_sc | |||
| 1 vwl_en_us/ur en_us | |||
| 1 vwl_en_wm/i en_wm | |||
| 3 vwl_fr/@R fr pt_pt | |||
| 1 vwl_fr/@R2 fr_ca | |||
| 1 vwl_hi/A hi | |||
| @@ -618,7 +618,7 @@ | |||
| 1 w/wa base | |||
| 1 w/we base | |||
| 3 w/wi base vi zhy | |||
| 12 w/wi2 en en_n en_us en_sc en_rp en_wm de nl la sv no | |||
| 11 w/wi2 en en_n en_us en_sc en_rp de nl la sv no | |||
| 1 w/wo base | |||
| 1 w/wu base | |||
| 5 w/xw base | |||
| @@ -124,7 +124,7 @@ endphoneme | |||
| phoneme i: | |||
| vowel starttype (i) endtype (i) | |||
| length 175 | |||
| length 190 | |||
| formants vowel/i_fnt | |||
| linkout ; | |||
| endphoneme | |||
| @@ -26,7 +26,8 @@ endphoneme | |||
| phoneme E | |||
| vowel starttype (e) endtype (e) | |||
| length 150 | |||
| formants vowel/ee_1 | |||
| formants vowel/e | |||
| // formants vowel/ee_1 | |||
| reduceto I 0 | |||
| endphoneme | |||
| @@ -61,7 +62,7 @@ endphoneme | |||
| phoneme 0 | |||
| vowel starttype (o) endtype (o) | |||
| length 140 | |||
| formants vowel/0_2 | |||
| formants vowel/0_3 | |||
| reduceto @ 0 | |||
| endphoneme | |||
| @@ -125,10 +126,10 @@ endphoneme | |||
| phoneme i: | |||
| vowel starttype (i) endtype (i) | |||
| vowel starttype (e) endtype (i) | |||
| length 220 | |||
| formants vwl_en_wm/i | |||
| after w w/wi2 | |||
| formants vdiph2/ei_3 | |||
| // after w w/wi2 | |||
| linkout ; | |||
| endphoneme | |||
| @@ -162,7 +163,6 @@ phoneme u: | |||
| vowel starttype (u) endtype (u) | |||
| length 200 | |||
| formants vdiph/@u | |||
| // before l/ vwl_en/u:L2-40+L/uL | |||
| endphoneme | |||
| @@ -35,7 +35,7 @@ | |||
| #include "translate.h" | |||
| #include "wave.h" | |||
| const char *version_string = "1.29.07 17.Sep.07"; | |||
| const char *version_string = "1.29.10 16.Oct.07"; | |||
| const int version_phdata = 0x012901; | |||
| int option_device_number = -1; | |||
| @@ -824,10 +824,12 @@ static void WavegenSetEcho(void) | |||
| echo_head = (delay * samplerate)/1000; | |||
| echo_length = echo_head; // ensure completion of echo at the end of speech | |||
| // echo_length = echo_head * 2; // perhaps allow 2 echo periods at the end of speech ? | |||
| // echo_amp units are 1/256ths of the amplitude of the original sound. | |||
| echo_amp = amp; | |||
| // compensate (partially) for increase in amplitude due to echo | |||
| general_amplitude = GetAmplitude(); | |||
| general_amplitude = ((general_amplitude * (512-amp))/512); | |||
| general_amplitude = ((general_amplitude * (500-amp))/500); | |||
| } // end of WavegenSetEcho | |||
| @@ -837,6 +839,8 @@ int PeaksToHarmspect(wavegen_peaks_t *peaks, int pitch, int *htab, int control) | |||
| // Calculate the amplitude of each harmonics from the formants | |||
| // Only for formants 0 to 5 | |||
| // control 0=initial call, 1=every 64 cycles | |||
| // pitch and freqs are Hz<<16 | |||
| int f; | |||
| @@ -897,10 +901,15 @@ int PeaksToHarmspect(wavegen_peaks_t *peaks, int pitch, int *htab, int control) | |||
| // find the nearest harmonic for HF peaks where we don't use shape | |||
| for(; pk<N_PEAKS; pk++) | |||
| { | |||
| peak_harmonic[pk] = peaks[pk].freq / pitch; | |||
| x = peaks[pk].height >> 14; | |||
| peak_height[pk] = (x * x * 5)/2; | |||
| // find the nearest harmonic for HF peaks where we don't use shape | |||
| if(control == 0) | |||
| { | |||
| // set this initially, but make changes only at the quiet point | |||
| peak_harmonic[pk] = peaks[pk].freq / pitch; | |||
| } | |||
| // only use harmonics up to half the samplerate | |||
| if(peak_harmonic[pk] >= hmax_samplerate) | |||
| peak_height[pk] = 0; | |||
| @@ -1110,6 +1119,7 @@ static int Wavegen() | |||
| int h; | |||
| int ix; | |||
| int z, z1, z2; | |||
| int echo; | |||
| int ov; | |||
| static int maxh, maxh2; | |||
| int pk; | |||
| @@ -1186,6 +1196,12 @@ static int Wavegen() | |||
| cycle_count++; | |||
| for(pk=wvoice->n_harmonic_peaks+1; pk<N_PEAKS; pk++) | |||
| { | |||
| // find the nearest harmonic for HF peaks where we don't use shape | |||
| peak_harmonic[pk] = peaks[pk].freq / (pitch*16); | |||
| } | |||
| // adjust amplitude to compensate for fewer harmonics at higher pitch | |||
| amplitude2 = (amplitude * pitch)/(100 << 11); | |||
| @@ -1326,12 +1342,14 @@ static int Wavegen() | |||
| } | |||
| z1 = z2 + (((total>>7) * amplitude2) >> 14); | |||
| z = (z1 * agc) >> 8; | |||
| z += ((echo_buf[echo_tail++] * echo_amp) >> 8); | |||
| echo = (echo_buf[echo_tail++] * echo_amp); | |||
| z1 += echo >> 8; | |||
| if(echo_tail >= N_ECHO_BUF) | |||
| echo_tail=0; | |||
| z = (z1 * agc) >> 8; | |||
| // check for overflow, 16bit signed samples | |||
| if(z >= 32768) | |||
| { | |||