41 #include "sigpr/EST_sigpr_utt.h"
42 #include "EST_cmd_line_options.h"
90 int main (
int argc,
char *argv[])
101 EST_String(
"[input file] -o [output file] [options]\n")+
102 "Summary: pitch track waveform files\n"
103 "use \"-\" to make input and output files stdin/out\n"
104 "-h Options help\n\n"+
105 options_wave_input()+
106 options_pda_general()+
108 options_track_output(),
111 default_pda_options(op);
112 set_parameters(op, al);
114 if (read_wave(sig, files.
first(), al) != format_ok)
122 save_pm(out_file, fz);
124 fz.
save(out_file, op.
S(
"f0_file_type",
"0"));
128 fz = differentiate(fz);
129 fz.
save(out_file +
".diff", op.
S(
"f0_file_type",
"0"));
137 op.
set(
"srpd_resize", 1);
140 option_override(op, al,
"pda_frame_shift",
"-shift");
141 option_override(op, al,
"pda_frame_length",
"-length");
142 option_override(op, al,
"max_pitch",
"-fmax");
143 option_override(op, al,
"min_pitch",
"-fmin");
146 option_override(op, al,
"lpf_cutoff",
"-u");
147 option_override(op, al,
"lpf_order",
"-forder");
149 option_override(op, al,
"decimation",
"-d");
150 option_override(op, al,
"noise_floor",
"-n");
151 option_override(op, al,
"min_v2uv_coef_thresh",
"-m");
152 option_override(op, al,
"v2uv_coef_thresh_ratio",
"-R");
153 option_override(op, al,
"v2uv_coef_thresh",
"-H");
154 option_override(op, al,
"anti_doubling_thresh",
"-t");
155 option_override(op, al,
"peak_tracking",
"-P");
157 option_override(op, al,
"f0_file_type",
"-otype");
158 option_override(op, al,
"wave_file_type",
"-itype");
160 if (al.
val(
"-L", 0) ==
"true")
161 op.
set(
"do_low_pass",
"true");
162 if (al.
val(
"-R", 0) ==
"true")
163 op.
set(
"do_low_pass",
"false");
216 float position, period;
221 outf =
new ofstream(filename);
225 cerr <<
"save_pm: can't write to file \"" << filename <<
"\"" << endl;
230 *outf <<
"LineType bars \n";
231 *outf <<
"LineStyle solid \n";
232 *outf <<
"LineWidth 0 \n";
233 *outf <<
"Freq 16\n";
234 *outf <<
"Format Binary \n";
235 *outf << char(12) <<
"\n";
248 period = 1.0 / fz.
a(i);
249 *outf << (position + period) * 1000.0 << endl;
void set(const EST_String &name, int ival)
const EST_String S(const EST_String &path) const
const V & val(const K &rkey, bool m=0) const
return value according to key (const)
const int present(const K &rkey) const
Returns true if key is present.
const T & first() const
return const reference to first item in list
int val(int i) const
return true if frame i is a value
EST_write_status save(const EST_String name, const EST_String EST_filetype="")
float & a(int i, int c=0)
float & t(int i=0)
return time position of frame i
int num_frames() const
return number of frames in track