41 #include "EST_cmd_line_options.h"
43 #define DEFAULT_TIME_SCALE 0.001
48 EST_write_status save_snns_pat(
const EST_String filename,
98 int main(
int argc,
char *argv[])
110 EST_String(
"[input file] -o [output file] [options]\n")+
111 "Summary: change/copy track files\n"
112 "use \"-\" to make input and output files stdin/out\n"
114 options_track_input()+
"\n"+
115 options_track_output()+
"\n"
116 "-info Print information about file and header. \n"
117 " This option gives useful information such as file \n"
118 " length, file type, channel names. No output is produced\n\n"
119 "-track_names <string> \n"
120 " File containing new names for output channels\n\n"
121 "-diff Differentiate contour. This performs simple \n"
122 " numerical differentiation on the contour by \n"
123 " subtracting the amplitude of the current frame \n"
124 " from the amplitude of the next. Although quick, \n"
125 " this technique is crude and not recommende as the \n"
126 " estimation of the derivate is done on only one point\n\n"
127 "-delta <int> Make delta coefficients (better form of differentiate).\n"
128 " The argument to this option is the regression length of \n"
129 " of the delta calculation and can be between 2 and 4 \n\n"
130 "-sm <float> Length of smoothing window in seconds. Various types of \n"
131 " smoothing are available for tracks. This options specifies \n"
132 " length of the smooting window which effects the degree of \n"
133 " smoothing, i.e. a longer value means more smoothing \n\n"
134 "-smtype <string> Smooth type, median or mean\n"
135 "-style <string> Convert track to other form. Currently only one form \n"
136 " \"label\" is supported. This uses a specified cut off to \n"
137 " make a label file, with two labels, one for above the \n"
138 " cut off (-pos) and one for below (-neg)\n\n"
139 "-t <float> threshold for track to label conversion \n"
140 "-neg <string> Name of negative label in track to label conversion \n"
141 "-pos <string> Name of positive label in track to label conversion \n"
142 "-pc <string> Combine given tracks in parallel. If option \n"
143 " is longest, pad shorter tracks to longest, else if \n"
144 " first pad/cut to match first input track \n" +
145 options_track_filetypes_long(),
156 override_lib_ops(settings, al);
165 if (read_TrackList(trlist, files, al) != read_ok)
168 if (files.length() == 0)
170 cerr << argv[0] <<
": no input files specified\n";
176 for (p = trlist.head(); p; p = p->next())
177 track_info(trlist(p));
182 ParallelTracks(tr, trlist, al.
val(
"-pc"));
184 else if (al.
val(
"-otype", 0) ==
"snns")
189 save_snns_pat(out_file, inpat, outpat);
196 for (p = trlist.head(); p; p = p->next())
204 track_smooth(tr, al.
fval(
"-sm"),al.
val(
"-smtype"));
209 cerr <<
"Using -diff and -delta together makes no sense !\n";
214 tr = differentiate(tr);
219 delta(tr,ntr,al.
ival(
"-delta"));
228 StringtoStrList(al.
val(
"-c"), s,
" ,");
229 StrListtoIList(s, il);
230 extract_channel(tr, ntr, il);
244 if (al.
present(
"-track_names"))
247 if(load_StrList(al.
val(
"-track_names"),new_names) != format_ok)
249 cerr <<
"Failed to load new track names file." << endl;
267 tr.
resize(EST_CURRENT, new_names);
291 if (al.
val(
"-style",0) ==
"label")
295 track_to_label(tr, lab, al.
fval(
"-t"));
297 track_to_label(tr, lab);
299 change_label(lab,
"pos", al.
val(
"-pos"));
301 change_label(lab,
"neg", al.
val(
"-neg"));
302 if (lab.
save(out_file) != write_ok)
324 if (tr.
save(out_file, al.
val(
"-otype")) != write_ok)
340 if (al.
val(
"-style", 0) ==
"label")
344 if (al.
present(
"-time_channel"))