mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-30 06:12:29 +00:00
[1.37.09]
Fixed pitch adjustments for mbrola voices (eg. -p option). Changes to languages: pt (mb-br4), fr, af git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@181 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+1
-18
@@ -212,23 +212,6 @@ void DisplayVoices(FILE *f_out, char *language)
|
||||
|
||||
|
||||
|
||||
static void PitchAdjust(int pitch_adjustment)
|
||||
{//==========================================
|
||||
int ix, factor;
|
||||
|
||||
voice->pitch_base = (voice->pitch_base * pitch_adjust_tab[pitch_adjustment])/128;
|
||||
|
||||
// adjust formants to give better results for a different voice pitch
|
||||
factor = 256 + (25 * (pitch_adjustment - 50))/50;
|
||||
for(ix=0; ix<=5; ix++)
|
||||
{
|
||||
voice->freq[ix] = (voice->freq2[ix] * factor)/256;
|
||||
}
|
||||
} // end of PitchAdjustment
|
||||
|
||||
|
||||
|
||||
|
||||
static int OpenWaveFile(const char *path, int rate)
|
||||
//=================================================
|
||||
{
|
||||
@@ -734,7 +717,7 @@ int main (int argc, char **argv)
|
||||
|
||||
if(pitch_adjustment != 50)
|
||||
{
|
||||
PitchAdjust(pitch_adjustment);
|
||||
SetParameter(espeakPITCH,pitch_adjustment,0);
|
||||
}
|
||||
DoVoiceChange(voice);
|
||||
|
||||
|
||||
@@ -987,7 +987,6 @@ void SpectSeq::MakeWave(int start, int end, PitchEnvelope &pitch)
|
||||
// }
|
||||
|
||||
len_samples = int(((total_length * lfactor + 50) * samplerate) / 1000);
|
||||
// SetPitch(len_samples,pitch.env,pitch.pitch1-pbase,pitch.pitch2-pbase);
|
||||
SetPitch(len_samples,pitch.env,9,44);
|
||||
|
||||
fname_speech = WavFileName();
|
||||
@@ -1064,7 +1063,6 @@ void SpectFrame::MakeWave(int control, PitchEnvelope &pitche, int amplitude, int
|
||||
|
||||
len_samples = (length * samplerate) / 1000;
|
||||
pbase = voice->pitch_base >> 12;
|
||||
// SetPitch(len_samples + 50,pitche.env,pitche.pitch1-pbase,pitche.pitch2-pbase);
|
||||
SetPitch(len_samples + 50,pitche.env,9,44);
|
||||
|
||||
fname_speech = WavFileName();
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "voice.h"
|
||||
|
||||
extern int Read4Bytes(FILE *f);
|
||||
extern void SetPitch2(voice_t *voice, int pitch1, int pitch2, int *pitch_base, int *pitch_range);
|
||||
|
||||
#ifdef USE_MBROLA_LIB
|
||||
|
||||
@@ -285,15 +286,9 @@ static char *WritePitch(int env, int pitch1, int pitch2, int split, int final)
|
||||
output[0] = 0;
|
||||
pitch_env = envelope_data[env];
|
||||
|
||||
if(pitch1 > pitch2)
|
||||
{
|
||||
x = pitch1; // swap values
|
||||
pitch1 = pitch2;
|
||||
pitch2 = x;
|
||||
}
|
||||
|
||||
pitch_base = voice->pitch_base + (pitch1 * voice->pitch_range);
|
||||
pitch_range = voice->pitch_base + (pitch2 * voice->pitch_range) - pitch_base;
|
||||
SetPitch2(voice, pitch1, pitch2, &pitch_base, &pitch_range);
|
||||
|
||||
|
||||
env_split = (split * 128)/100;
|
||||
if(env_split < 0)
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
#include "translate.h"
|
||||
#include "wave.h"
|
||||
|
||||
const char *version_string = "1.37.07 19.Jul.08";
|
||||
const char *version_string = "1.37.09 31.Jul.08";
|
||||
const int version_phdata = 0x013400;
|
||||
|
||||
int option_device_number = -1;
|
||||
|
||||
+31
-25
@@ -1594,14 +1594,41 @@ static void SetAmplitude(int length, unsigned char *amp_env, int value)
|
||||
}
|
||||
|
||||
|
||||
void SetPitch(int length, unsigned char *env, int pitch1, int pitch2)
|
||||
{//==================================================================
|
||||
// length in samples
|
||||
void SetPitch2(voice_t *voice, int pitch1, int pitch2, int *pitch_base, int *pitch_range)
|
||||
{//======================================================================================
|
||||
int x;
|
||||
int base;
|
||||
int range;
|
||||
int pitch_value;
|
||||
|
||||
if(pitch1 > pitch2)
|
||||
{
|
||||
x = pitch1; // swap values
|
||||
pitch1 = pitch2;
|
||||
pitch2 = x;
|
||||
}
|
||||
|
||||
if((pitch_value = embedded_value[EMBED_P]) > MAX_PITCH_VALUE)
|
||||
pitch_value = MAX_PITCH_VALUE;
|
||||
pitch_value -= embedded_value[EMBED_T]; // adjust tone for announcing punctuation
|
||||
if(pitch_value < 0)
|
||||
pitch_value = 0;
|
||||
|
||||
base = (voice->pitch_base * pitch_adjust_tab[pitch_value])/128;
|
||||
range = (voice->pitch_range * embedded_value[EMBED_R])/50;
|
||||
|
||||
// compensate for change in pitch when the range is narrowed or widened
|
||||
base -= (range - voice->pitch_range)*18;
|
||||
|
||||
*pitch_base = base + (pitch1 * range);
|
||||
*pitch_range = base + (pitch2 * range) - *pitch_base;
|
||||
}
|
||||
|
||||
|
||||
void SetPitch(int length, unsigned char *env, int pitch1, int pitch2)
|
||||
{//==================================================================
|
||||
// length in samples
|
||||
|
||||
#ifdef LOG_FRAMES
|
||||
if(option_log_frames)
|
||||
{
|
||||
@@ -1623,28 +1650,7 @@ if(option_log_frames)
|
||||
else
|
||||
pitch_inc = (256 * ENV_LEN * STEPSIZE)/length;
|
||||
|
||||
if(pitch1 > pitch2)
|
||||
{
|
||||
x = pitch1; // swap values
|
||||
pitch1 = pitch2;
|
||||
pitch2 = x;
|
||||
}
|
||||
|
||||
if((pitch_value = embedded_value[EMBED_P]) > MAX_PITCH_VALUE)
|
||||
pitch_value = MAX_PITCH_VALUE;
|
||||
pitch_value -= embedded_value[EMBED_T]; // adjust tone for announcing punctuation
|
||||
if(pitch_value < 0)
|
||||
pitch_value = 0;
|
||||
|
||||
base = (wvoice->pitch_base * pitch_adjust_tab[pitch_value])/128;
|
||||
range = (wvoice->pitch_range * embedded_value[EMBED_R])/50;
|
||||
|
||||
// compensate for change in pitch when the range is narrowed or widened
|
||||
base -= (range - wvoice->pitch_range)*18;
|
||||
|
||||
pitch_base = base + (pitch1 * range);
|
||||
pitch_range = base + (pitch2 * range) - pitch_base;
|
||||
|
||||
SetPitch2(wvoice, pitch1, pitch2, &pitch_base, &pitch_range);
|
||||
// set initial pitch
|
||||
pitch = ((pitch_env[0]*pitch_range)>>8) + pitch_base; // Hz << 12
|
||||
|
||||
|
||||
Reference in New Issue
Block a user