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,
56 int main(
int argc,
char *argv[])
68 EST_String(
"[input file] -o [output file] [options]\n")+
69 "Summary: change/copy track files\n"
70 "use \"-\" to make input and output files stdin/out\n"
72 options_track_input()+
"\n"+
73 options_track_output()+
"\n"
74 "-info Print information about file and header. \n"
75 " This option gives useful information such as file \n"
76 " length, file type, channel names. No output is produced\n\n"
77 "-track_names <string> \n"
78 " File containing new names for output channels\n\n"
79 "-diff Differentiate contour. This performs simple \n"
80 " numerical differentiation on the contour by \n"
81 " subtracting the amplitude of the current frame \n"
82 " from the amplitude of the next. Although quick, \n"
83 " this technique is crude and not recommende as the \n"
84 " estimation of the derivate is done on only one point\n\n"
85 "-delta <int> Make delta coefficients (better form of differentiate).\n"
86 " The argument to this option is the regression length of \n"
87 " of the delta calculation and can be between 2 and 4 \n\n"
88 "-sm <float> Length of smoothing window in seconds. Various types of \n"
89 " smoothing are available for tracks. This options specifies \n"
90 " length of the smooting window which effects the degree of \n"
91 " smoothing, i.e. a longer value means more smoothing \n\n"
92 "-smtype <string> Smooth type, median or mean\n"
93 "-style <string> Convert track to other form. Currently only one form \n"
94 " \"label\" is supported. This uses a specified cut off to \n"
95 " make a label file, with two labels, one for above the \n"
96 " cut off (-pos) and one for below (-neg)\n\n"
97 "-t <float> threshold for track to label conversion \n"
98 "-neg <string> Name of negative label in track to label conversion \n"
99 "-pos <string> Name of positive label in track to label conversion \n"
100 "-pc <string> Combine given tracks in parallel. If option \n"
101 " is longest, pad shorter tracks to longest, else if \n"
102 " first pad/cut to match first input track \n" +
103 options_track_filetypes_long(),
114 override_lib_ops(settings, al);
123 if (read_TrackList(trlist, files, al) != read_ok)
126 if (files.length() == 0)
128 cerr << argv[0] <<
": no input files specified\n";
134 for (p = trlist.head(); p; p = p->next())
135 track_info(trlist(p));
140 ParallelTracks(tr, trlist, al.
val(
"-pc"));
142 else if (al.
val(
"-otype", 0) ==
"snns")
147 save_snns_pat(out_file, inpat, outpat);
154 for (p = trlist.head(); p; p = p->next())
162 track_smooth(tr, al.
fval(
"-sm"),al.
val(
"-smtype"));
167 cerr <<
"Using -diff and -delta together makes no sense !\n";
188 extract_channel(tr, ntr, il);
202 if (al.
present(
"-track_names"))
207 cerr <<
"Failed to load new track names file." << endl;
225 tr.
resize(EST_CURRENT, new_names);
249 if (al.
val(
"-style",0) ==
"label")
253 track_to_label(tr, lab, al.
fval(
"-t"));
255 track_to_label(tr, lab);
257 change_label(lab,
"pos", al.
val(
"-pos"));
259 change_label(lab,
"neg", al.
val(
"-neg"));
260 if (lab.
save(out_file) != write_ok)
282 if (tr.
save(out_file, al.
val(
"-otype")) != write_ok)
298 if (al.
val(
"-style", 0) ==
"label")
302 if (al.
present(
"-time_channel"))
void delta(EST_Track &tr, EST_Track &d, int regression_length=3)
int override_val(const EST_String rkey, const EST_String rval)
add to end of list or overwrite. If rval is empty, do nothing
int ival(const EST_String &rkey, int m=1) const
int StrListtoIList(EST_StrList &s, EST_IList &il)
Convert a list of strings to a list of integers.
int num_channels() const
return number of channels in track
int override_fval(const EST_String rkey, const float rval)
add to end of list or overwrite. If rval is empty, do nothing
float fval(const EST_String &rkey, int m=1) const
T & nth(int n)
return the Nth value
const EST_String & sval(const EST_String &rkey, int m=1) const
void resize(int num_frames, int num_channels, bool preserve=1)
void StringtoStrList(EST_String s, EST_StrList &l, EST_String sep)
Convert a EST_String to a EST_StrList by separating tokens in s delimited by the separator sep...
EST_write_status save(const EST_String name, const EST_String EST_filetype="")
const int present(const K &rkey) const
Returns true if key is present.
const V & val(const K &rkey, bool m=0) const
return value according to key (const)
void append(const T &item)
add item onto end of list
EST_write_status save(const EST_String &filename, bool evaluate_ff=false) const
EST_Track differentiate(EST_Track &c, float samp_int=0.0)
EST_read_status load_StrList(EST_String filename, EST_StrList &l)
Load tokens from a file and return them in a EST_StrList.