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

@@ -37,6 +37,7 @@

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

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

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

@@ -31,6 +31,7 @@
#include "readclause.h"
#include "setlengths.h"
#include "synthdata.h"
#include "wavegen.h"

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

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

@@ -21,6 +21,9 @@
#define ESPEAK_NG_SPECT_H

#include <espeak-ng/espeak_ng.h>

#include "wavegen.h"

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


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

@@ -51,6 +51,7 @@
#include "dictionary.h"
#include "readclause.h"
#include "synthdata.h"
#include "wavegen.h"

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

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

@@ -35,6 +35,7 @@
#include "dictionary.h"
#include "readclause.h"
#include "synthdata.h"
#include "wavegen.h"

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

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

@@ -36,6 +36,7 @@
#include "intonation.h"
#include "setlengths.h"
#include "synthdata.h"
#include "wavegen.h"

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

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

@@ -35,7 +35,6 @@ extern "C"

#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 STEPSIZE 64 // 2.9mS at 22 kHz sample rate

@@ -129,22 +128,6 @@ typedef struct { // 44 bytes
unsigned char klattp[5]; // AV, FNZ, Tilt, Aspr, Skew
} 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 {
unsigned char *pitch_env;
int pitch; // pitch Hz*256
@@ -462,17 +445,7 @@ extern intptr_t wcmdq[N_WCMDQ][4];
extern int wcmdq_head;
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);
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 int samplerate;
@@ -546,8 +519,6 @@ int DoSample3(PHONEME_DATA *phdata, int length_mod, int amp);
int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_LIST *plist, int modulation);
int PauseLength(int pause, int control);

void InitBreath(void);

#ifdef __cplusplus
}
#endif

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

@@ -41,6 +41,7 @@
#include "dictionary.h"
#include "readclause.h"
#include "synthdata.h"
#include "wavegen.h"

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

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

@@ -32,6 +32,8 @@
#include <espeak-ng/espeak_ng.h>
#include <espeak-ng/speak_lib.h>

#include "wavegen.h"

#include "synthesize.h"
#include "speech.h"
#include "phoneme.h"
@@ -80,6 +82,7 @@ static RESONATOR rbreath[N_PEAKS];
static int harm_sqrt_n = 0;

#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 *harmspect;
static int hswitch = 0;
@@ -1393,7 +1396,7 @@ static int SpeedUp(short *outbuf, int length_in, int length_out, int end_of_text
#endif

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

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

@@ -0,0 +1,76 @@
/*
* 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