spect.h
2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
* Copyright (C) 2005 to 2007 by Jonathan Duddington
* email: jonsd@users.sourceforge.net
* Copyright (C) 2013-2016 Reece H. Dunn
*
* 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/>.
*/
#ifdef __cplusplus
extern "C"
{
#endif
#define FRAME_WIDTH 1000 // max width for 8000kHz frame
#define MAX_DISPLAY_FREQ 9500
#define FRAME_HEIGHT 240
#define T_ZOOMOUT 301
#define T_ZOOMIN 302
#define T_USEPITCHENV 303
#define T_SAMPRATE 304
#define T_PITCH1 305
#define T_PITCH2 306
#define T_DURATION 307
#define T_AMPLITUDE 308
#define T_AMPFRAME 309
#define T_TIMEFRAME 310
#define T_TIMESEQ 311
#define T_AV 312
#define T_AVP 313
#define T_FRIC 314
#define T_FRICBP 315
#define T_ASPR 316
#define T_TURB 317
#define T_SKEW 318
#define T_TILT 319
#define T_KOPEN 320
#define T_FNZ 321
#define FILEID1_SPECTSEQ 0x43455053
#define FILEID2_SPECTSEQ 0x51455354 // for eSpeak sequence
#define FILEID2_SPECTSEK 0x4b455354 // for Klatt sequence
#define FILEID2_SPECTSQ2 0x32515354 // with Klatt data
#define FILEID1_SPC2 0x32435053 // an old format for spectrum files
#define FILEID1_PITCHENV 0x43544950
#define FILEID2_PITCHENV 0x564e4548
#define FILEID1_PRAATSEQ 0x41415250
#define FILEID2_PRAATSEQ 0x51455354
typedef struct {
unsigned short pitch1;
unsigned short pitch2;
unsigned char env[128];
} PitchEnvelope;
typedef struct {
short freq;
short bandw;
} formant_t;
typedef struct {
short pkfreq;
short pkheight;
short pkwidth;
short pkright;
short klt_bw;
short klt_ap;
short klt_bp;
} peak_t;
typedef struct {
int keyframe;
short amp_adjust;
float length_adjust;
double rms;
float time;
float pitch;
float length;
float dx;
unsigned short nx;
short markers;
int max_y;
USHORT *spect; // sqrt of harmonic amplitudes, 1-nx at 'pitch'
short klatt_param[N_KLATTP2];
formant_t formants[N_PEAKS]; // this is just the estimate given by Praat
peak_t peaks[N_PEAKS];
} SpectFrame;
double GetFrameRms(SpectFrame *frame, int amp);
typedef struct {
int numframes;
short amplitude;
int spare;
char *name;
SpectFrame **frames;
PitchEnvelope pitchenv;
int pitch1;
int pitch2;
int duration;
int grid;
int bass_reduction;
int max_x;
short max_y;
int file_format;
} SpectSeq;
SpectSeq *SpectSeqCreate();
void SpectSeqDestroy(SpectSeq *spect);
espeak_ng_STATUS LoadSpectSeq(SpectSeq *spect, const char *filename);
#ifdef __cplusplus
}
#endif