45 #include "sigpr/EST_filter.h"
46 #include "sigpr/EST_pitchmark.h"
47 #include "ling_class/EST_Relation.h"
49 #include "EST_inline_utils.h"
50 #include "EST_wave_aux.h"
51 #include "EST_track_aux.h"
57 int lx_ho,
int df_lf,
int df_lo,
int mo,
int debug)
62 pm.set_equal_space(
false);
66 cout <<
"pitchmark 1\n";
68 FIRlowpass_double_filter(lx, lx_lf, lx_lo);
69 FIRhighpass_double_filter(lx, lx_hf, lx_ho);
72 cout <<
"pitchmark 2\n";
75 lx.save(
"tmpfilt.lx");
86 lxdiff.save(
"tmpdiff.lx");
91 FIRlowpass_double_filter(lxdiff, df_lf, df_lo);
94 simple_mean_smooth(lxdiff, mo);
97 lxdiff.save(
"tmpfiltdiff.lx");
99 neg_zero_cross_pick(lxdiff, pm);
108 int lx_lf, lx_lo, lx_hf, lx_ho, df_lf, df_lo, mo, debug;
110 lx_lf = op.
present(
"lx_low_frequency") ?
111 op.
I(
"lx_low_frequency") : 400;
112 lx_lo = op.
present(
"lx_low_order") ?
113 op.
I(
"lx_low_order") : 19;
115 lx_hf = op.
present(
"lx_high_frequency") ?
116 op.
I(
"lx_high_frequency") : 40;
117 lx_ho = op.
present(
"lx_high_order") ?
118 op.
I(
"lx_high_order") : 19;
120 df_lf = op.
present(
"df_low_frequency") ?
121 op.
I(
"df_low_frequency") : 1000;
122 df_lo = op.
present(
"df_low_order") ?
123 op.
I(
"df_low_order") : 0;
125 mo = op.
present(
"median_order") ?
126 op.
I(
"median_order") : 19;
128 debug = op.
present(
"pm_debug") ? 1 : 0;
130 return pitchmark(lx, lx_lf, lx_lo, lx_hf, lx_ho, df_lf, df_lo,
137 void pm_min_check(
EST_Track &pm,
float min)
141 for (i = j = 0; i < pm.
num_frames() - 1; ++i, ++j)
144 while ((i < (pm.
num_frames() - 1)) && ((pm.
t(i + 1) - pm.
t(i)) < min))
153 void pm_fill(
EST_Track &pm,
float new_end,
float max,
float min,
float def)
167 new_pm.
resize(
int(new_end / min));
174 int dropped=0, added=0;
178 float current = pm.
t(j);
180 if (current > new_end)
183 if (current - last < min)
189 else if (current-last > max)
192 int num = ifloor((current - last)/ def);
193 float size = (current-last) / num;
194 for (i = 1; i <= num; i++)
196 new_pm[npm] = last + i * size;
203 new_pm[npm] = pm.
t(j);
209 if (new_end - last > max)
212 int num = ifloor((new_end - last)/ def);
213 float size = (new_end -last) / num;
214 for (i = 1; i <= num; i++)
216 new_pm[npm] = last + i * size;
228 for (i = 0; i < npm; i++)
238 if ((lx.
a(i -1) > 0) && (lx.
a(i) <= 0))
241 pm.
resize(j, EST_CURRENT);
256 seg->
set(
"end",pm.
t(i));
268 f0.
a(i, 0) = 1.0 / (f0.
t(i) - prev_pm);
283 period = get_time_frame_size(pm, pm.
index_below(fz.
t(i)));
284 fz.
a(i) = 1.0 /period;