Edinburgh Speech Tools  2.1-release
EST_Event.h
Go to the documentation of this file.
1 /*************************************************************************/
2 /* */
3 /* Centre for Speech Technology Research */
4 /* University of Edinburgh, UK */
5 /* Copyright (c) 1995,1996 */
6 /* All Rights Reserved. */
7 /* */
8 /* Permission is hereby granted, free of charge, to use and distribute */
9 /* this software and its documentation without restriction, including */
10 /* without limitation the rights to use, copy, modify, merge, publish, */
11 /* distribute, sublicense, and/or sell copies of this work, and to */
12 /* permit persons to whom this work is furnished to do so, subject to */
13 /* the following conditions: */
14 /* 1. The code must retain the above copyright notice, this list of */
15 /* conditions and the following disclaimer. */
16 /* 2. Any modifications must be clearly marked as such. */
17 /* 3. Original authors' names are not deleted. */
18 /* 4. The authors' names are not used to endorse or promote products */
19 /* derived from this software without specific prior written */
20 /* permission. */
21 /* */
22 /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */
23 /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
24 /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
25 /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */
26 /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
27 /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
28 /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
29 /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
30 /* THIS SOFTWARE. */
31 /* */
32 /*************************************************************************/
33 /* Author : Paul Taylor */
34 /* Date : July 1995 */
35 /*-----------------------------------------------------------------------*/
36 /* Event class header file */
37 /* */
38 /*=======================================================================*/
39 
40 // Warning: These event classes can be used as items in the EST_Stream
41 // int he normal way. However, the EventSI class has internal pointers to
42 // adjacent events which it uses to work out various parameters. Thus,
43 // when making a EST_Stream of events, it is important to link the events
44 // pointers as well.
45 
46 #ifndef __Event_H__
47 #define __Event_H__
48 
49 #include "EST_String.h"
50 
51 #ifndef FALSE
52 # define FALSE (0)
53 #endif
54 #ifndef TRUE
55 # define TRUE (1)
56 #endif
57 
58 /* Class commented out as everything is private, uninitialized and
59  unused */
60 #if 0
61 class RFCelement{
62  float amp;
63  float dur;
64  float start_amp;
65  float start_pos;
66  EST_String type;
67 };
68 #endif
69 
70 class EventBase{
71  private:
72  public:
74  int save(EST_String filename, EST_String type = "");
75 
76 };
77 
78 class EventRFC: public EventBase{
79 public:
80  void init() {rise_amp = 0.0; rise_dur = 0.0;
81  start_amp =0.0; fall_amp = 0.0; fall_dur = 0.0;
82  start_pos = 0.0; peak_pos = 0.0; type = ""; }
83 
84  float rise_amp;
85  float rise_dur;
86  float fall_amp;
87  float fall_dur;
88  float peak_pos;
89  float start_amp;
90  float start_pos;
91  friend ostream& operator << (ostream& s, EventRFC &e)
92  {
93  s << e.type << " " << e.rise_amp << " " << e.rise_dur
94  << " " << e.fall_amp << " " << e.fall_dur
95  << " " << e.start_amp << " " << e.start_pos
96  << std::endl;
97  return s;
98  }
99 };
100 
101 class EventSI: public EventBase {
102 private:
103  float s_f0;
104  float s_pos;
105  float p_f0;
106  float p_pos;
107  float e_pos;
108  float e_f0;
109 
110 public:
111  void init();
112 
113  float amp();
114  float dur();
115 
116  float rise_amp();
117  float rise_dur();
118  float fall_amp();
119  float fall_dur();
120 
121  float start_f0();
122  float start_pos();
123  float peak_f0();
124  float peak_pos();
125  float end_f0();
126  float end_pos();
127 
128  void set_start_f0(float a);
129  void set_start_pos(float a);
130  void set_peak_f0(float a);
131  void set_peak_pos(float a);
132  void set_end_f0(float a);
133  void set_end_pos(float a);
134 
137 
138  friend ostream& operator << (ostream& s, EventSI &e)
139  {
140  s << e.type << " ra:" << e.rise_amp() << " rd:" << e.rise_dur()
141  << "fa: " << e.fall_amp() << " fd:" << e.fall_dur()
142  << " sf0:" << e.start_f0() << " spos:" << e.start_pos()
143  << " pf0:" << e.peak_f0() << " ppos:" << e.peak_pos()
144  << " ef0:" << e.end_f0() << " epos:" << e.end_pos()
145  << std::endl;
146  return s;
147  }
148 };
149 
150 class EventTilt: public EventBase{
151 private:
152  float samp;
153  float sdur;
154  float stilt;
155  float spos;
156  float s_f0;
157  float s_pos;
158 
159 public:
160  void init();
161 
162  float amp();
163  float dur();
164  float tilt();
165  float pos();
166 
167  void set_amp(float a);
168  void set_dur(float a);
169  void set_tilt(float a);
170  void set_pos(float a);
171 
172  float start_f0();
173  float start_pos();
174  void set_start_f0(float a);
175  void set_start_pos(float a);
176 
177  friend ostream& operator << (ostream& s, EventTilt &e)
178  {
179  s << e.type << " " << e.amp() << " " << e.dur()
180  << " " << e.tilt() << " " << e.pos()
181  << " sf0 " << e.start_f0() << " " << e.start_pos()
182  << std::endl;
183  return s;
184  }
185 
186 };
187 
188 void gc_eventsi(void *w);
189 void gc_eventtilt(void *w);
190 void gc_eventrfc(void *w);
191 
192 #endif // __Event_H__
float tilt()
float peak_f0()
float end_pos()
float start_amp
Definition: EST_Event.h:89
float fall_amp()
float pos()
float fall_dur()
float start_pos()
bool save(Lattice &lattice, EST_String filename)
float end_f0()
EventSI * sp
Definition: EST_Event.h:136
float start_f0()
void gc_eventrfc(void *w)
float start_f0()
float peak_pos()
void gc_eventtilt(void *w)
float rise_amp
Definition: EST_Event.h:84
float dur()
float rise_amp()
float amp()
float fall_amp
Definition: EST_Event.h:86
float rise_dur
Definition: EST_Event.h:85
EventSI * sn
Definition: EST_Event.h:135
float rise_dur()
EST_String type
Definition: EST_Event.h:73
float peak_pos
Definition: EST_Event.h:88
float start_pos
Definition: EST_Event.h:90
float fall_dur
Definition: EST_Event.h:87
void gc_eventsi(void *w)
void init()
Definition: EST_Event.h:80
float start_pos()
ostream & operator<<(ostream &st, const EST_FeatureData &d)