0
|
1 /* |
|
2 * ENDPOINT.H - endpoint class definition |
|
3 * |
|
4 * Bruce T. Lowerre, Public domain, 1995, 1997 |
|
5 * |
|
6 * $Log$ |
|
7 * Revision 1.1 2001/10/10 19:54:49 pkienzle |
|
8 * Initial revision |
|
9 * |
|
10 * Revision 1.1 2001/04/22 08:29:30 pkienzle |
|
11 * adding in all of matcompat |
|
12 * |
|
13 * Revision 1.2 1997/05/23 19:59:01 lowerre |
|
14 * renamed class endpoint to endpointer, conflicts with <rpcsvc/nis.h> |
|
15 * |
|
16 * Revision 1.1 1997/05/14 20:34:34 lowerre |
|
17 * Initial revision |
|
18 * |
|
19 * |
|
20 */ |
|
21 |
|
22 /* The endpointer is used to determine the start and end of a live |
|
23 * input signal. Unlike a pre-recorded utterance, a live input signal |
|
24 * is open-ended in that the actual start and end of the signal is |
|
25 * totally unknown. The search, using HMM techniques with a silence |
|
26 * model, will usually do a fairly good job of guessing the start of |
|
27 * the signal. However, the actual end of the signal is unknown to |
|
28 * the recognizer. Reaching the end state in the recognizer does not |
|
29 * necessarily mean the end of signal. Therefore, the end of signal |
|
30 * must be calculated by some means. This is the job of the end point |
|
31 * detector. */ |
|
32 |
|
33 #ifndef ENDPOINT_H |
|
34 #define ENDPOINT_H |
|
35 |
|
36 //#include <general.h> // contains general defs |
|
37 |
|
38 typedef enum |
|
39 { |
|
40 NOSILENCE, |
|
41 INSILENCE, |
|
42 START, |
|
43 INSIGNAL, |
|
44 END |
|
45 } EPSTATE; |
|
46 |
|
47 typedef enum |
|
48 { |
|
49 EP_NONE, |
|
50 EP_RESET, |
|
51 EP_SILENCE, |
|
52 EP_SIGNAL, |
|
53 EP_INUTT, |
|
54 EP_MAYBEEND, |
|
55 EP_ENDOFUTT, |
|
56 EP_NOTEND, |
|
57 EP_NOSTARTSILENCE |
|
58 } EPTAG; |
|
59 |
|
60 class endpointer |
|
61 { |
|
62 private: |
|
63 EPSTATE epstate; |
|
64 float ave, |
|
65 noise, |
|
66 begthresh, |
|
67 energy, |
|
68 maxpeak, |
|
69 endthresh, |
|
70 begfact, |
|
71 endfact, |
|
72 energyfact, |
|
73 mnbe, |
|
74 peakreturn, // average energy |
|
75 dpnoise, |
|
76 triggerfact, // schmidt trigger percent |
|
77 minstartsilence, |
|
78 *lastdpnoise; // array of size numdpnoise |
|
79 long samprate, // sampling rate in Hz |
|
80 windowsize, // window size in samples |
|
81 stepsize, // step size in samples |
|
82 scnt, |
|
83 avescnt, |
|
84 vcnt, |
|
85 evcnt, |
|
86 voicecount, |
|
87 minfriclng, |
|
88 bscnt, |
|
89 zccnt, |
|
90 startframe, |
|
91 endframe, |
|
92 ncount, |
|
93 zcthresh, |
|
94 numdpnoise, |
|
95 minrise, |
|
96 maxpause, |
|
97 maxipause, |
|
98 startblip, |
|
99 endblip, |
|
100 minuttlng, |
|
101 minvoicelng, |
|
102 zc; // zero cross count per window |
|
103 bool startsilenceok, |
|
104 low; // is signal currently low or high? |
|
105 void zcpeakpick // get zc count and average energy |
|
106 ( |
|
107 short* // raw samples |
|
108 ); |
|
109 void setnoise (); // initial noise level set |
|
110 void averagenoise (); // average noise array and shift |
|
111 public: |
|
112 endpointer // constructor |
|
113 ( |
|
114 long, // sampling rate in Hz |
|
115 long, // window size in samples |
|
116 long, // step size in samples |
|
117 long = 700, // endof utt silence default, msec |
|
118 long = 100, // minuttlng default, msec |
|
119 long = 600, // zcthresh default, Hz |
|
120 float = 40.0, // begfact default |
|
121 float = 80.0, // endfact default |
|
122 float = 200.0, // energyfact default |
|
123 float = 2000.0, // minstartsilence default |
|
124 float = 3.0, // triggerfact default |
|
125 long = 6, // numdpnoise default |
|
126 long = 50, // minfriclng default, msec |
|
127 long = 150, // maxpause default, msec |
|
128 long = 30, // startblip default, msec |
|
129 long = 20, // endblip default, msec |
|
130 long = 60, // minvoicelng default, msec |
|
131 long = 50 // minrise default, msec |
|
132 ); |
|
133 ~endpointer (); // destructor |
|
134 |
|
135 void initendpoint (); // initialize variables |
|
136 EPTAG getendpoint |
|
137 ( |
|
138 short* // raw samples of window size |
|
139 ); |
|
140 const char *gettagname // convert tag to ascii |
|
141 ( |
|
142 EPTAG |
|
143 ); |
|
144 void printvars (); // print variables |
|
145 long getzc () {return (zc);} // get the zero cross count |
|
146 float getenergy () {return (peakreturn);} // get the RMS energy |
|
147 }; // end class endpointer |
|
148 |
|
149 |
|
150 #endif |