1597
void SetPitch(int length, unsigned char *env, int pitch1, int pitch2)
1598
{//==================================================================
1599
// length in samples
1597
void SetPitch2(voice_t *voice, int pitch1, int pitch2, int *pitch_base, int *pitch_range)
1598
{//======================================================================================
1603
1602
int pitch_value;
1606
if(option_log_frames)
1608
f_log=fopen("log-espeakedit","a");
1611
fprintf(f_log," pitch %3d %3d %3dmS\n",pitch1,pitch2,(length*1000)/samplerate);
1617
if((pitch_env = env)==NULL)
1618
pitch_env = env_fall; // default
1624
pitch_inc = (256 * ENV_LEN * STEPSIZE)/length;
1626
1604
if(pitch1 > pitch2)
1628
1606
x = pitch1; // swap values
1636
1614
if(pitch_value < 0)
1637
1615
pitch_value = 0;
1639
base = (wvoice->pitch_base * pitch_adjust_tab[pitch_value])/128;
1640
range = (wvoice->pitch_range * embedded_value[EMBED_R])/50;
1617
base = (voice->pitch_base * pitch_adjust_tab[pitch_value])/128;
1618
range = (voice->pitch_range * embedded_value[EMBED_R])/50;
1642
1620
// compensate for change in pitch when the range is narrowed or widened
1643
base -= (range - wvoice->pitch_range)*18;
1645
pitch_base = base + (pitch1 * range);
1646
pitch_range = base + (pitch2 * range) - pitch_base;
1621
base -= (range - voice->pitch_range)*18;
1623
*pitch_base = base + (pitch1 * range);
1624
*pitch_range = base + (pitch2 * range) - *pitch_base;
1628
void SetPitch(int length, unsigned char *env, int pitch1, int pitch2)
1629
{//==================================================================
1630
// length in samples
1633
if(option_log_frames)
1635
f_log=fopen("log-espeakedit","a");
1638
fprintf(f_log," pitch %3d %3d %3dmS\n",pitch1,pitch2,(length*1000)/samplerate);
1644
if((pitch_env = env)==NULL)
1645
pitch_env = env_fall; // default
1651
pitch_inc = (256 * ENV_LEN * STEPSIZE)/length;
1653
SetPitch2(wvoice, pitch1, pitch2, &pitch_base, &pitch_range);
1648
1654
// set initial pitch
1649
1655
pitch = ((pitch_env[0]*pitch_range)>>8) + pitch_base; // Hz << 12