43 #include "EST_Track.h"
44 #include "EST_error.h"
52 rfc_synthesis(fz, ev, f_shift, no_conn);
59 float t, amp, f_shift, a=0, start_f0;
65 dur = ev.
F(
"rise_dur");
66 amp = ev.
F(
"rise_amp");
67 start_f0 = peak_f0 - amp;
69 for (j = 0, t = 0.0; t < dur; t += f_shift, ++j)
71 a = unit_curve(amp, dur, t) + start_f0;
77 dur = ev.
F(
"fall_dur");
78 amp = ev.
F(
"fall_amp");
80 for (t = 0.0; t < dur; t += f_shift, ++j)
82 a = unit_curve(amp, dur, t) + peak_f0;
92 void fill_connection_values(
EST_Track &fz,
float start_f0,
float start_pos,
93 float end_f0,
float end_pos)
98 if ((end_pos - start_pos) == 0)
101 m = (end_f0 - start_f0) / (end_pos - start_pos);
104 fz.
a(j) = (m * (float) j * f_shift) + start_f0;
120 float start_pos=0, start_f0=0;
121 int start_index, end_index;
122 float end_pos, end_f0;
125 if (event_item(*ev.
tail()))
126 n = (int)(ceil((ev.
tail()->
F(
"time") +
127 ev.
tail()->
F(
"rfc.fall_dur",0)) / f_shift)) + 1;
129 n = (int)(ceil(ev.
tail()->
F(
"time")/ f_shift)) + 1;
132 fz.set_equal_space(
true);
141 for (e = ev.
head(); e != 0; e = e->next())
145 start_pos = e->
F(
"time") - e->
F(
"rfc.rise_dur");
146 end_pos = e->
F(
"time") + e->
F(
"rfc.fall_dur");
148 if ((start_pos / f_shift-(
int)start_pos / f_shift)>.5)
149 start_index=int(start_pos / f_shift+1);
151 start_index = (int) start_pos / f_shift;
152 if(end_pos / f_shift-(
int)end_pos / f_shift>.5)
153 end_index = int( end_pos / f_shift+1);
155 end_index = (int) end_pos / f_shift;
158 fz.
sub_track(sub, start_index, (end_index - start_index) + 1,
164 synthesize_rf_event(sub, e->
A(
"rfc"), e->
F(
"ev.f0"));
172 for (e = ev.
head(); e->next() != 0; e = e->next())
174 if (e->
S(
"name") ==
"phrase_end")
181 start_f0 = e->
F(
"ev.f0") + e->
F(
"rfc.fall_amp", 0.0);
182 start_pos= e->
F(
"time") + e->
F(
"rfc.fall_dur", 0.0);
184 end_f0 = nn->
F(
"ev.f0") - nn->
F(
"rfc.rise_amp", 0.0);
185 end_pos = nn->
F(
"time") - nn->
F(
"rfc.rise_dur", 0.0);
187 if ((start_pos / f_shift-(
int)start_pos / f_shift)>.5)
188 start_index=int(start_pos / f_shift+1);
190 start_index = (int) start_pos / f_shift;
191 if(end_pos / f_shift-(
int)end_pos / f_shift>.5)
192 end_index = int( end_pos / f_shift+1);
194 end_index = (int) end_pos / f_shift;
197 if (start_index >= end_index)
200 fz.
sub_track(sub, start_index, end_index - start_index+1 , 0, EST_ALL);
202 fill_connection_values(sub, start_f0, start_pos, end_f0, end_pos);