58 int lx_ho,
int df_lf,
int df_lo,
int mo,
int debug)
67 cout <<
"pitchmark 1\n";
73 cout <<
"pitchmark 2\n";
76 lx.
save(
"tmpfilt.lx");
87 lxdiff.
save(
"tmpdiff.lx");
98 lxdiff.
save(
"tmpfiltdiff.lx");
109 int lx_lf, lx_lo, lx_hf, lx_ho, df_lf, df_lo, mo, debug;
111 lx_lf = op.
present(
"lx_low_frequency") ?
112 op.
I(
"lx_low_frequency") : 400;
113 lx_lo = op.
present(
"lx_low_order") ?
114 op.
I(
"lx_low_order") : 19;
116 lx_hf = op.
present(
"lx_high_frequency") ?
117 op.
I(
"lx_high_frequency") : 40;
118 lx_ho = op.
present(
"lx_high_order") ?
119 op.
I(
"lx_high_order") : 19;
121 df_lf = op.
present(
"df_low_frequency") ?
122 op.
I(
"df_low_frequency") : 1000;
123 df_lo = op.
present(
"df_low_order") ?
124 op.
I(
"df_low_order") : 0;
126 mo = op.
present(
"median_order") ?
127 op.
I(
"median_order") : 19;
129 debug = op.
present(
"pm_debug") ? 1 : 0;
131 return pitchmark(lx, lx_lf, lx_lo, lx_hf, lx_ho, df_lf, df_lo,
142 for (i = j = 0; i < pm.
num_frames() - 1; ++i, ++j)
145 while ((i < (pm.
num_frames() - 1)) && ((pm.
t(i + 1) - pm.
t(i)) < min))
168 new_pm.
resize(
int(new_end / min));
175 int dropped=0, added=0;
179 float current = pm.
t(j);
181 if (current > new_end)
184 if (current - last < min)
190 else if (current-last > max)
193 int num = ifloor((current - last)/ def);
194 float size = (current-last) / num;
195 for (i = 1; i <= num; i++)
197 new_pm[npm] = last + i * size;
204 new_pm[npm] = pm.
t(j);
210 if (new_end - last > max)
213 int num = ifloor((new_end - last)/ def);
214 float size = (new_end -last) / num;
215 for (i = 1; i <= num; i++)
217 new_pm[npm] = last + i * size;
229 for (i = 0; i < npm; i++)
239 if ((lx.
a(i -1) > 0) && (lx.
a(i) <= 0))
257 seg->
set(
"end",pm.
t(i));
269 f0.
a(i, 0) = 1.0 / (f0.
t(i) - prev_pm);
285 fz.
a(i) = 1.0 /period;
A class for storing digital waveforms. The waveform is stored as an array of 16 bit shorts...
void set_sample_rate(const int n)
Set sampling rate to n
void pm_fill(EST_Track &pm, float new_end, float max, float min, float def)
float end() const
return time of last value in track
void simple_mean_smooth(EST_Track &c, ssize_t n, ssize_t channel=0)
A vector class for floating point numbers. EST_FVector x should be used instead of float *x wherever ...
void set_value(ssize_t i)
set frame i to be a value
void set(const EST_String &name, ssize_t ival)
int num_channels() const
return number of channels in track
void pm_to_label(EST_Track &pm, EST_Relation &lab)
ssize_t index_below(float x) const
return the frame index before time t
void pm_min_check(EST_Track &pm, float min)
ssize_t num_samples() const
return the number of samples in the waveform
void resize(ssize_t num_frames, int num_channels, bool preserve=1)
short & a(ssize_t i, ssize_t channel=0)
EST_write_status save(const EST_String filename, const EST_String EST_filetype="")
float max(float a, float b)
EST_Track pitchmark(EST_Wave &lx, int lx_lf, int lx_lo, int lx_hf, int lx_ho, int df_lf, int df_lo, int mo, int debug)
float & t(ssize_t i=0)
return time position of frame i
float & a(ssize_t i, int c=0)
void pm_to_f0(EST_Track &pm, EST_Track &f0)
void FIRlowpass_double_filter(EST_Wave &sigin, int freq, int order=DEFAULT_FILTER_ORDER)
float min(float a, float b)
void delta(EST_Wave &tr, EST_Wave &d, int regression_length)
int present(const EST_String &name) const
ssize_t num_frames() const
return number of frames in track
void resize(int num_samples, int num_channels=EST_ALL, int set=1)
resize the waveform
int sample_rate() const
return the sampling rate (frequency)
void FIRhighpass_double_filter(EST_Wave &sigin, int freq, int order=DEFAULT_FILTER_ORDER)
float t(ssize_t i) const
return the time position in seconds of the ith sample
EST_Item * append(EST_Item *si)
int I(const EST_String &path) const
float get_time_frame_size(EST_Track &pms, int i, int prefer_prev=0)
void set_equal_space(bool t)
void fill_time(float t, int start=1)
void resize(int n, int set=1)
resize vector
void neg_zero_cross_pick(EST_Wave &lx, EST_Track &pm)