Browse Source

headers: add new file wavegen.h with declarations of functions in wavegen.c

master
Juho Hiltunen 7 years ago
parent
commit
f00ff91fe4

+ 1
- 0
src/libespeak-ng/compiledata.c View File



#include "readclause.h" #include "readclause.h"
#include "synthdata.h" #include "synthdata.h"
#include "wavegen.h"


#include "error.h" #include "error.h"
#include "phoneme.h" #include "phoneme.h"

+ 1
- 0
src/libespeak-ng/setlengths.c View File

#include "readclause.h" #include "readclause.h"
#include "setlengths.h" #include "setlengths.h"
#include "synthdata.h" #include "synthdata.h"
#include "wavegen.h"


#include "phoneme.h" #include "phoneme.h"
#include "voice.h" #include "voice.h"

+ 3
- 0
src/libespeak-ng/spect.h View File

#define ESPEAK_NG_SPECT_H #define ESPEAK_NG_SPECT_H


#include <espeak-ng/espeak_ng.h> #include <espeak-ng/espeak_ng.h>

#include "wavegen.h"

#include "synthesize.h" #include "synthesize.h"
#include "speech.h" #include "speech.h"



+ 1
- 0
src/libespeak-ng/speech.c View File

#include "dictionary.h" #include "dictionary.h"
#include "readclause.h" #include "readclause.h"
#include "synthdata.h" #include "synthdata.h"
#include "wavegen.h"


#include "speech.h" #include "speech.h"
#include "phoneme.h" #include "phoneme.h"

+ 1
- 0
src/libespeak-ng/synth_mbrola.c View File

#include "dictionary.h" #include "dictionary.h"
#include "readclause.h" #include "readclause.h"
#include "synthdata.h" #include "synthdata.h"
#include "wavegen.h"


#include "speech.h" #include "speech.h"
#include "phoneme.h" #include "phoneme.h"

+ 1
- 0
src/libespeak-ng/synthesize.c View File

#include "intonation.h" #include "intonation.h"
#include "setlengths.h" #include "setlengths.h"
#include "synthdata.h" #include "synthdata.h"
#include "wavegen.h"


#include "phoneme.h" #include "phoneme.h"
#include "voice.h" #include "voice.h"

+ 0
- 29
src/libespeak-ng/synthesize.h View File



#define N_PHONEME_LIST 1000 // enough for source[N_TR_SOURCE] full of text, else it will truncate #define N_PHONEME_LIST 1000 // enough for source[N_TR_SOURCE] full of text, else it will truncate


#define MAX_HARMONIC 400 // 400 * 50Hz = 20 kHz, more than enough
#define N_SEQ_FRAMES 25 // max frames in a spectrum sequence (real max is ablut 8) #define N_SEQ_FRAMES 25 // max frames in a spectrum sequence (real max is ablut 8)
#define STEPSIZE 64 // 2.9mS at 22 kHz sample rate #define STEPSIZE 64 // 2.9mS at 22 kHz sample rate


unsigned char klattp[5]; // AV, FNZ, Tilt, Aspr, Skew unsigned char klattp[5]; // AV, FNZ, Tilt, Aspr, Skew
} frame_t2; // without the extra Klatt parameters } frame_t2; // without the extra Klatt parameters


// formant data used by wavegen
typedef struct {
int freq; // Hz<<16
int height; // height<<15
int left; // Hz<<16
int right; // Hz<<16
double freq1; // floating point versions of the above
double height1;
double left1;
double right1;
double freq_inc; // increment by this every 64 samples
double height_inc;
double left_inc;
double right_inc;
} wavegen_peaks_t;

typedef struct { typedef struct {
unsigned char *pitch_env; unsigned char *pitch_env;
int pitch; // pitch Hz*256 int pitch; // pitch Hz*256
extern int wcmdq_head; extern int wcmdq_head;
extern int wcmdq_tail; extern int wcmdq_tail;


// from Wavegen file
int WcmdqFree(void);
void WcmdqStop(void);
int WcmdqUsed(void);
void WcmdqInc(void);
void WavegenInit(int rate, int wavemult_fact);
int WavegenFill(void);
void MarkerEvent(int type, unsigned int char_position, int value, int value2, unsigned char *out_ptr); void MarkerEvent(int type, unsigned int char_position, int value, int value2, unsigned char *out_ptr);
int GetAmplitude(void);
void SetPitch2(voice_t *voice, int pitch1, int pitch2, int *pitch_base, int *pitch_range);
int PeaksToHarmspect(wavegen_peaks_t *peaks, int pitch, int *htab, int control);


extern unsigned char *wavefile_data; extern unsigned char *wavefile_data;
extern int samplerate; extern int samplerate;
int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_LIST *plist, int modulation); int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_LIST *plist, int modulation);
int PauseLength(int pause, int control); int PauseLength(int pause, int control);


void InitBreath(void);

#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

+ 1
- 0
src/libespeak-ng/voices.c View File

#include "dictionary.h" #include "dictionary.h"
#include "readclause.h" #include "readclause.h"
#include "synthdata.h" #include "synthdata.h"
#include "wavegen.h"


#include "speech.h" #include "speech.h"
#include "phoneme.h" #include "phoneme.h"

+ 4
- 1
src/libespeak-ng/wavegen.c View File

#include <espeak-ng/espeak_ng.h> #include <espeak-ng/espeak_ng.h>
#include <espeak-ng/speak_lib.h> #include <espeak-ng/speak_lib.h>


#include "wavegen.h"

#include "synthesize.h" #include "synthesize.h"
#include "speech.h" #include "speech.h"
#include "phoneme.h" #include "phoneme.h"
static int harm_sqrt_n = 0; static int harm_sqrt_n = 0;


#define N_LOWHARM 30 #define N_LOWHARM 30
#define MAX_HARMONIC 400 // 400 * 50Hz = 20 kHz, more than enough
static int harm_inc[N_LOWHARM]; // only for these harmonics do we interpolate amplitude between steps static int harm_inc[N_LOWHARM]; // only for these harmonics do we interpolate amplitude between steps
static int *harmspect; static int *harmspect;
static int hswitch = 0; static int hswitch = 0;
#endif #endif


// Call WavegenFill2, and then speed up the output samples. // Call WavegenFill2, and then speed up the output samples.
int WavegenFill()
int WavegenFill(void)
{ {
int finished; int finished;
unsigned char *p_start; unsigned char *p_start;

+ 76
- 0
src/libespeak-ng/wavegen.h View File

/*
* Copyright (C) 2005 to 2015 by Jonathan Duddington
* email: [email protected]
* Copyright (C) 2015-2018 Reece H. Dunn
* Copyright (C) 2018 Juho Hiltunen
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see: <http://www.gnu.org/licenses/>.
*/

#ifndef ESPEAK_NG_WAVEGEN_H
#define ESPEAK_NG_WAVEGEN_H

#include "voice.h"

#ifdef __cplusplus
extern "C"
{
#endif

typedef struct {
int freq; // Hz<<16
int height; // height<<15
int left; // Hz<<16
int right; // Hz<<16
double freq1; // floating point versions of the above
double height1;
double left1;
double right1;
double freq_inc; // increment by this every 64 samples
double height_inc;
double left_inc;
double right_inc;
} wavegen_peaks_t;


int GetAmplitude(void);
void InitBreath(void);
int PeaksToHarmspect(wavegen_peaks_t *peaks,
int pitch,
int *htab,
int control);

void SetPitch2(voice_t *voice,
int pitch1,
int pitch2,
int *pitch_base,
int *pitch_range);

void WavegenInit(int rate,
int wavemult_fact);


int WavegenFill(void);
void WavegenSetVoice(voice_t *v);
int WcmdqFree(void);
void WcmdqStop(void);
int WcmdqUsed(void);
void WcmdqInc(void);

#ifdef __cplusplus
}
#endif

#endif


Loading…
Cancel
Save