Debian Codegraph @

src/cg/cst_mlsa.h

raw
1 /*********************************************************************/
2 /* */
3 /* Nagoya Institute of Technology, Aichi, Japan, */
4 /* Nara Institute of Science and Technology, Nara, Japan */
5 /* and */
6 /* Carnegie Mellon University, Pittsburgh, PA */
7 /* Copyright (c) 2003-2004 */
8 /* All Rights Reserved. */
9 /* */
10 /* Permission is hereby granted, free of charge, to use and */
11 /* distribute this software and its documentation without */
12 /* restriction, including without limitation the rights to use, */
13 /* copy, modify, merge, publish, distribute, sublicense, and/or */
14 /* sell copies of this work, and to permit persons to whom this */
15 /* work is furnished to do so, subject to the following conditions: */
16 /* */
17 /* 1. The code must retain the above copyright notice, this list */
18 /* of conditions and the following disclaimer. */
19 /* 2. Any modifications must be clearly marked as such. */
20 /* 3. Original authors' names are not deleted. */
21 /* */
22 /* NAGOYA INSTITUTE OF TECHNOLOGY, NARA INSTITUTE OF SCIENCE AND */
23 /* TECHNOLOGY, CARNEGIE MELLON UNIVERSITY, AND THE CONTRIBUTORS TO */
24 /* THIS WORK DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, */
25 /* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, */
26 /* IN NO EVENT SHALL NAGOYA INSTITUTE OF TECHNOLOGY, NARA */
27 /* INSTITUTE OF SCIENCE AND TECHNOLOGY, CARNEGIE MELLON UNIVERSITY, */
28 /* NOR THE CONTRIBUTORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR */
29 /* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM */
30 /* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, */
31 /* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN */
32 /* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
33 /* */
34 /*********************************************************************/
35 /* */
36 /* Author : Tomoki Toda ([email protected]) */
37 /* Date : June 2004 */
38 /* */
39 /* Modified by Alan W Black ([email protected]) Jan 2006 */
40 /* taken from festvox/src/vc/ back into Festival */
41 /* Modified by Alan W Black ([email protected]) Nov 2007 */
42 /* taken from Festival into Flite */
43 /*-------------------------------------------------------------------*/
44 /* */
45 /* Subroutine for Speech Synthesis */
46 /* */
47 /*-------------------------------------------------------------------*/
48
49 #ifndef __CST_MLSA_H
50 #define __CST_MLSA_H
51
52 #include "cst_audio.h"
53 #include "cst_wave.h"
54
55 /* static void waveampcheck(DVECTOR wav, XBOOL msg_flag); */
56
57 #define RANDMAX 32767
58 #define B0 0x00000001
59 #define B28 0x10000000
60 #define B31 0x80000000
61 #define B31_ 0x7fffffff
62 #define Z 0x00000000
63
64 typedef struct _VocoderSetup {
65
66 int fprd;
67 int iprd;
68 int seed;
69 int pd;
70 unsigned long next;
71 Boolean gauss;
72 double p1;
73 double pc;
74 double pj;
75 double pade[21];
76 double *ppade;
77 double *c, *cc, *cinc, *d1;
78 double rate;
79
80 int sw;
81 double r1, r2, s;
82
83 int x;
84
85 /* for postfiltering */
86 int size;
87 double *d;
88 double *g;
89 double *mc;
90 double *cep;
91 double *ir;
92 int o;
93 int irleng;
94
95 /* for MIXED EXCITATION */
96 int ME_order;
97 int ME_num;
98 double *hpulse;
99 double *hnoise;
100
101 double *xpulsesig;
102 double *xnoisesig;
103
104 const double * const *h;
105
106 } VocoderSetup;
107
108 static void init_vocoder(double fs, int framel, int m,
109 VocoderSetup *vs, cst_cg_db *cg_db);
110 static void vocoder(double p, double *mc,
111 const float *str,
112 int m, cst_cg_db *cg_db,
113 VocoderSetup *vs, cst_wave *wav, long *pos);
114 static double mlsadf(double x, double *b, int m, double a, int pd, double *d,
115 VocoderSetup *vs);
116 static double mlsadf1(double x, double *b, int m, double a, int pd, double *d,
117 VocoderSetup *vs);
118 static double mlsadf2(double x, double *b, int m, double a, int pd, double *d,
119 VocoderSetup *vs);
120 static double mlsafir (double x, double *b, int m, double a, double *d);
121 static double nrandom (VocoderSetup *vs);
122 static double rnd (unsigned long *next);
123 static unsigned long srnd (unsigned long seed);
124 static void mc2b (double *mc, double *b, int m, double a);
125 static double b2en (double *b, int m, double a, VocoderSetup *vs);
126 static void b2mc (double *b, double *mc, int m, double a);
127 static void freqt (double *c1, int m1, double *c2, int m2, double a,
128 VocoderSetup *vs);
129 static void c2ir (double *c, int nc, double *h, int leng);
130
131 static void free_vocoder(VocoderSetup *vs);
132
133 #endif /* __CST_MLSA_H */