Browse Source

Ensure echo completes one echo period at the end of speech.


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@90 d46cf337-b52f-0410-862d-fd96e6ae7743
master
jonsd 18 years ago
parent
commit
0e3e90126e
2 changed files with 32 additions and 3 deletions
  1. 7
    1
      dictsource/fr_list
  2. 25
    2
      src/wavegen.cpp

+ 7
- 1
dictsource/fr_list View File


// This file in UTF8 encoded // This file in UTF8 encoded


// 2006-11-18 Gilles Casse <[email protected]> // 2006-11-18 Gilles Casse <[email protected]>
couvent k'uvt2 $verb couvent k'uvt2 $verb
concurrent kO~kyR'A~ concurrent kO~kyR'A~
récurrent RekyR'A~ récurrent RekyR'A~
ferment fErm'A~
ferment f'Ermt2 $verb
sergent sErZ'A~
serment sErm'A~
serpent sErp'A~




// MAIN WORD DICTIONARY // MAIN WORD DICTIONARY








+ 25
- 2
src/wavegen.cpp View File

#define N_ECHO_BUF 5500 // max of 250mS at 22050 Hz #define N_ECHO_BUF 5500 // max of 250mS at 22050 Hz
static int echo_head; static int echo_head;
static int echo_tail; static int echo_tail;
static int echo_length = 0; // period (in sample\) to ensure completion of echo at the end of speech, set in WavegenSetEcho()
static int echo_amp = 0; static int echo_amp = 0;
static short echo_buf[N_ECHO_BUF]; static short echo_buf[N_ECHO_BUF];


if(delay == 0) if(delay == 0)
amp = 0; amp = 0;
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 * 2; // perhaps allow 2 echo periods at the end of speech ?
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 * (512-amp))/512);
}
} // end of WavegenSetEcho






static int n_samples; static int n_samples;
int value=0; int value=0;


if(length == 0)
return(0);

nsamples = 0; nsamples = 0;
samplecount = 0; samplecount = 0;


int length; int length;
int result; int result;
static int resume=0; static int resume=0;
static int echo_complete=0;


#ifdef TEST_MBROLA #ifdef TEST_MBROLA
if(mbrola_name[0] != 0) if(mbrola_name[0] != 0)
{ {
if(WcmdqUsed() <= 0) if(WcmdqUsed() <= 0)
{ {
#define echo2
#ifdef echo2
if(echo_complete > 0)
{
// continue to play silence until echo is completed
resume = PlaySilence(echo_complete,resume);
if(resume == 1)
return(0); // not yet finished
}
#endif

if(fill_zeros) if(fill_zeros)
{ {
while(out_ptr < out_end) while(out_ptr < out_end)
break; break;


case WCMD_PAUSE: case WCMD_PAUSE:
if(resume==0)
{
echo_complete -= length;
}
n_mix_wavefile = 0; n_mix_wavefile = 0;
if(length==0) break;
result = PlaySilence(length,resume); result = PlaySilence(length,resume);
break; break;


case WCMD_WAVE: case WCMD_WAVE:
echo_complete = echo_length;
n_mix_wavefile = 0; n_mix_wavefile = 0;
result = PlayWave(length,resume,(unsigned char*)q[2], q[3] & 0xff, q[3] >> 8); result = PlayWave(length,resume,(unsigned char*)q[2], q[3] & 0xff, q[3] >> 8);
break; break;
case WCMD_SPECT2: // as WCMD_SPECT but stop any concurrent wave file case WCMD_SPECT2: // as WCMD_SPECT but stop any concurrent wave file
n_mix_wavefile = 0; // ... and drop through to WCMD_SPECT case n_mix_wavefile = 0; // ... and drop through to WCMD_SPECT case
case WCMD_SPECT: case WCMD_SPECT:
echo_complete = echo_length;
result = Wavegen2(length & 0xffff,q[1] >> 16,resume,(frame_t *)q[2],(frame_t *)q[3]); result = Wavegen2(length & 0xffff,q[1] >> 16,resume,(frame_t *)q[2],(frame_t *)q[3]);
break; break;



Loading…
Cancel
Save