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
| ie (ntal I'E | ie (ntal I'E | ||||
| g) ie (n i: | g) ie (n i: | ||||
| _sc) ie (n aI@ | _sc) ie (n aI@ | ||||
| ?8 _sc) ie (n aIa2 | |||||
| ie (nCiA I2'E | ie (nCiA I2'E | ||||
| fr) ie (nd E | fr) ie (nd E | ||||
| f) ie (nd i: | f) ie (nd i: |
| hierar) ch (i C | hierar) ch (i C | ||||
| me) ch (a C | me) ch (a C | ||||
| te) ch (n C | te) ch (n C | ||||
| _pe) ch C | |||||
| pszi) ch C | pszi) ch C | ||||
| pszy) ch C | pszy) ch C | ||||
| mün) ch (en C | mün) ch (en C | ||||
| maso) ch (istA C | maso) ch (istA C | ||||
| monar) ch (i C | monar) ch (i C | ||||
| _pe) ch C | |||||
| szé) ch tS | szé) ch tS | ||||
| _zi) ch (y tS | _zi) ch (y tS | ||||
| _nyílá) s S | _nyílá) s S | ||||
| _o) slo slo: | _o) slo slo: | ||||
| _o) sló slo: | _o) sló slo: | ||||
| tojá) s S | |||||
| sz (öld Sz | sz (öld Sz | ||||
| va) s (zabl S|| | va) s (zabl S|| | ||||
| má) zc (sz z | má) zc (sz z | ||||
| mé) zc (sz z | mé) zc (sz z | ||||
| nehé) z (sé z | nehé) z (sé z | ||||
| pén) z z | |||||
| szá) z (sz z | szá) z (sz z | ||||
| tű) z (sz z | tű) z (sz z | ||||
| ví) z (sz z | ví) z (sz z |
| 3 vdiph/0i_2 en_sc no en_wi | 3 vdiph/0i_2 en_sc no en_wi | ||||
| 3 vdiph2/e@ en_sc en_wi | 3 vdiph2/e@ en_sc en_wi | ||||
| 1 vdiph2/ea ro | 1 vdiph2/ea ro | ||||
| 1 vdiph2/ei_3 en_wm | |||||
| 1 vdiph2/eo ro | 1 vdiph2/eo ro | ||||
| 1 vdiph2/e[u ro | 1 vdiph2/e[u ro | ||||
| 1 vdiph2/i@ en_n | 1 vdiph2/i@ en_n | ||||
| 1 vowel/@- base | 1 vowel/@- base | ||||
| 4 vowel/& en_rp fi hi sv | 4 vowel/& en_rp fi hi sv | ||||
| 4 vowel/0 base2 en hi pt | 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 fr | ||||
| 2 vowel/&_2 en_us | 2 vowel/&_2 en_us | ||||
| 6 vowel/@_3 en_sc de hi | 6 vowel/@_3 en_sc de hi | ||||
| 2 vowel/aa_8 en_us | 2 vowel/aa_8 en_us | ||||
| 3 vowel/a_en en fr | 3 vowel/a_en en fr | ||||
| 1 vowel/@_bck hi | 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 | 2 vowel/e# en_sc | ||||
| 7 vowel/e_2 en_sc de hi it sv no | 7 vowel/e_2 en_sc de hi it sv no | ||||
| 1 vowel/e_3 hu | 1 vowel/e_3 hu | ||||
| 1 vowel/e_5 en_sc | 1 vowel/e_5 en_sc | ||||
| 3 vowel/ee fr pl sv | 3 vowel/ee fr pl sv | ||||
| 2 vowel/e_e en_sc is | 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 | 4 vowel/ee_2 en en_us cy nl | ||||
| 1 vowel/ee#_2 sv | 1 vowel/ee#_2 sv | ||||
| 4 vowel/ee_3 af pt vi | 4 vowel/ee_3 af pt vi | ||||
| 1 vwl_en_us/oor en_us | 1 vwl_en_us/oor en_us | ||||
| 3 vwl_en_us/or en_us en_sc | 3 vwl_en_us/or en_us en_sc | ||||
| 1 vwl_en_us/ur en_us | 1 vwl_en_us/ur en_us | ||||
| 1 vwl_en_wm/i en_wm | |||||
| 3 vwl_fr/@R fr pt_pt | 3 vwl_fr/@R fr pt_pt | ||||
| 1 vwl_fr/@R2 fr_ca | 1 vwl_fr/@R2 fr_ca | ||||
| 1 vwl_hi/A hi | 1 vwl_hi/A hi | ||||
| 1 w/wa base | 1 w/wa base | ||||
| 1 w/we base | 1 w/we base | ||||
| 3 w/wi base vi zhy | 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/wo base | ||||
| 1 w/wu base | 1 w/wu base | ||||
| 5 w/xw base | 5 w/xw base |
| phoneme i: | phoneme i: | ||||
| vowel starttype (i) endtype (i) | vowel starttype (i) endtype (i) | ||||
| length 175 | |||||
| length 190 | |||||
| formants vowel/i_fnt | formants vowel/i_fnt | ||||
| linkout ; | linkout ; | ||||
| endphoneme | endphoneme |
| phoneme E | phoneme E | ||||
| vowel starttype (e) endtype (e) | vowel starttype (e) endtype (e) | ||||
| length 150 | length 150 | ||||
| formants vowel/ee_1 | |||||
| formants vowel/e | |||||
| // formants vowel/ee_1 | |||||
| reduceto I 0 | reduceto I 0 | ||||
| endphoneme | endphoneme | ||||
| phoneme 0 | phoneme 0 | ||||
| vowel starttype (o) endtype (o) | vowel starttype (o) endtype (o) | ||||
| length 140 | length 140 | ||||
| formants vowel/0_2 | |||||
| formants vowel/0_3 | |||||
| reduceto @ 0 | reduceto @ 0 | ||||
| endphoneme | endphoneme | ||||
| phoneme i: | phoneme i: | ||||
| vowel starttype (i) endtype (i) | |||||
| vowel starttype (e) endtype (i) | |||||
| length 220 | length 220 | ||||
| formants vwl_en_wm/i | |||||
| after w w/wi2 | |||||
| formants vdiph2/ei_3 | |||||
| // after w w/wi2 | |||||
| linkout ; | linkout ; | ||||
| endphoneme | endphoneme | ||||
| vowel starttype (u) endtype (u) | vowel starttype (u) endtype (u) | ||||
| length 200 | length 200 | ||||
| formants vdiph/@u | formants vdiph/@u | ||||
| // before l/ vwl_en/u:L2-40+L/uL | |||||
| endphoneme | endphoneme | ||||
| #include "translate.h" | #include "translate.h" | ||||
| #include "wave.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; | const int version_phdata = 0x012901; | ||||
| int option_device_number = -1; | int option_device_number = -1; |
| echo_head = (delay * samplerate)/1000; | echo_head = (delay * samplerate)/1000; | ||||
| echo_length = echo_head; // ensure completion of echo at the end of speech | 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_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; | echo_amp = amp; | ||||
| // compensate (partially) for increase in amplitude due to echo | // compensate (partially) for increase in amplitude due to echo | ||||
| general_amplitude = GetAmplitude(); | general_amplitude = GetAmplitude(); | ||||
| general_amplitude = ((general_amplitude * (512-amp))/512); | |||||
| general_amplitude = ((general_amplitude * (500-amp))/500); | |||||
| } // end of WavegenSetEcho | } // end of WavegenSetEcho | ||||
| // Calculate the amplitude of each harmonics from the formants | // Calculate the amplitude of each harmonics from the formants | ||||
| // Only for formants 0 to 5 | // Only for formants 0 to 5 | ||||
| // control 0=initial call, 1=every 64 cycles | |||||
| // pitch and freqs are Hz<<16 | // pitch and freqs are Hz<<16 | ||||
| int f; | int f; | ||||
| // find the nearest harmonic for HF peaks where we don't use shape | // find the nearest harmonic for HF peaks where we don't use shape | ||||
| for(; pk<N_PEAKS; pk++) | for(; pk<N_PEAKS; pk++) | ||||
| { | { | ||||
| peak_harmonic[pk] = peaks[pk].freq / pitch; | |||||
| x = peaks[pk].height >> 14; | x = peaks[pk].height >> 14; | ||||
| peak_height[pk] = (x * x * 5)/2; | 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 | // only use harmonics up to half the samplerate | ||||
| if(peak_harmonic[pk] >= hmax_samplerate) | if(peak_harmonic[pk] >= hmax_samplerate) | ||||
| peak_height[pk] = 0; | peak_height[pk] = 0; | ||||
| int h; | int h; | ||||
| int ix; | int ix; | ||||
| int z, z1, z2; | int z, z1, z2; | ||||
| int echo; | |||||
| int ov; | int ov; | ||||
| static int maxh, maxh2; | static int maxh, maxh2; | ||||
| int pk; | int pk; | ||||
| cycle_count++; | 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 | // adjust amplitude to compensate for fewer harmonics at higher pitch | ||||
| amplitude2 = (amplitude * pitch)/(100 << 11); | amplitude2 = (amplitude * pitch)/(100 << 11); | ||||
| } | } | ||||
| z1 = z2 + (((total>>7) * amplitude2) >> 14); | 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) | if(echo_tail >= N_ECHO_BUF) | ||||
| echo_tail=0; | echo_tail=0; | ||||
| z = (z1 * agc) >> 8; | |||||
| // check for overflow, 16bit signed samples | // check for overflow, 16bit signed samples | ||||
| if(z >= 32768) | if(z >= 32768) | ||||
| { | { |