41#include "EST_speech_class.h"
42#include "EST_string_aux.h"
43#include "EST_cmd_line.h"
44#include "EST_cmd_line_options.h"
45#include "sigpr/EST_sigpr_utt.h"
46#include "sigpr/EST_filter.h"
48#define EPSILON (0.0001)
50#define DEFAULT_FRAME_SIZE 0.01
51#define DEFAULT_FRAME_FACTOR 2.0
52#define DEFAULT_LPC_ORDER 16
53#define DEFAULT_REF_ORDER 16
54#define DEFAULT_CEP_ORDER 12
55#define DEFAULT_FBANK_ORDER 20
56#define DEFAULT_MELCEP_ORDER 12
57#define DEFAULT_WINDOW "hamming"
58#define DEFAULT_PREEMPH 0
59#define DEFAULT_LIFTER 0
64#define MINIMUM_PITCH_PERIOD (0.0033)
65#define MAXIMUM_PITCH_PERIOD (0.02)
66#define DEFAULT_PITCH_PERIOD (0.01)
80 " lpc linear predictive coding\n"
81 " cep cepstrum coding from lpc coefficients\n"
82 " melcep Mel scale cepstrum coding via fbank\n"
83 " fbank Mel scale log filterbank analysis\n"
84 " lsf line spectral frequencies\n"
85 " ref Linear prediction reflection coefficients\n"
88 " energy: root mean square energy\n";
155 EST_String(
"[input file] -o [output file]\n")+
156 "Summary: generate acoustic feature vectors for a waveform file \n"
157 "use \"-\" to make input and output files stdin/out \n"
158 "-h Options help \n\n" +
159 options_wave_input() +
160 options_track_output() +
" \n"
161 "-shift <float> frame spacing in seconds for fixed frame analysis. This \n"
162 " doesn't have to be the same as the output file spacing - the \n"
163 " S option can be used to resample the track before saving \n"
164 " default: "+ftoString(DEFAULT_FRAME_SIZE) +
"\n\n"
165 "-factor <float> Frames lengths will be FACTOR times the \n"
166 " local pitch period. \n"
167 " default: "+ftoString(DEFAULT_FRAME_FACTOR) +
"\n\n"
168 "-pm <ifile> Pitch mark file name. This is used to \n"
169 " specify the positions of the analysis frames for pitch \n"
170 " synchronous analysis. Pitchmark files are just standard \n"
171 " track files, but the channel information is ignored and \n"
172 " only the time positions are used\n"
173 "-size <float> If specified with pm, size is used as the \n"
174 " fixed window size (times factor) rather than size within \n"
177 "-coefs <string> list of basic types of processing required. \n"
178 " Permissible types are: \n" + sigpr_options_supported()+
" \n"
179 "-delta <string> list of delta types of processing required. Basic \n"
180 " processing does not need to be specified for this option to work. \n"
181 " Permissible types are: \n" + sigpr_options_supported()+
" \n"
182 "-acc <string> list of acceleration (delta delta) processing \n"
183 " required. Basic processing does not need to be specified for \n"
184 " this option to work. \n"
185 " Permissible types are: \n"
186 + sigpr_options_supported()+
"\n"
187 "-window_type <string> Type of window used on waveform. \n"
188 " Permissible types are: \n" +
190 " default: \"DEFAULT_WINDOW\"\n\n"
191 "-lpc_order <int> Order of lpc analysis. \n\n"
192 "-ref_order <int> Order of lpc reflection coefficient analysis. \n\n"
193 "-cep_order <int> Order of lpc cepstral analysis.\n\n"
194 "-melcep_order <int> Order of Mel cepstral analysis.\n\n"
195 "-fbank_order <int> Order of filter bank analysis.\n\n"
196 "-preemph <float> Perform pre-emphasis with this factor.\n\n"
197 "-lifter <float> lifter coefficient.\n\n"
198 "-usepower use power rather than energy in filter bank \n"
200 "-include_c0 include cepstral coefficient 0\n\n"
201 "-order <string> order of analyses\n",
files,
al);
210 StringtoStrList(
al.val(
"-order"),
tlist);
213 if (read_wave(
sig,
files.first(),
al) != read_ok)
217 if (
al.present(
"-pm"))
219 if (read_track(
full,
al.val(
"-pm"),
al))
224 full.resize((
int)
ceil(
sig.end() / op.
F(
"frame_shift")), 0);
225 full.fill_time(op.
F(
"frame_shift"));
229 add_channels_to_map(map,
coef_list, op, 0);
231 add_channels_to_map(map,
acc_list, op, 2);
235 full.resize(EST_CURRENT, map);
237 if (
al.present(
"-preemph"))
238 pre_emphasis(
sig,
al.fval(
"-preemph"));
240 if(
al.present(
"-usepower"))
241 cerr <<
"sig2fv: -usepower currently not supported" <<
endl;
247 if (
al.present(
"-S"))
250 full.sample(
al.fval(
"-S"));
253 if (
full.save(out_file,
al.val(
"-otype", 0)) != write_ok)
255 cerr <<
"sig2fv: failed to write output to \"" << out_file
271 for (c =
clist.head(),
o =
olist.head(); c &&
o; c= c->next(),
o =
o->next())
273 k =
clist(c) +
"_order";
281 op.
set(
"frame_shift", DEFAULT_FRAME_SIZE);
282 op.
set(
"frame_factor", DEFAULT_FRAME_FACTOR);
283 op.
set(
"window_type", DEFAULT_WINDOW);
285 op.
set(
"preemph", DEFAULT_PREEMPH);
286 op.
set(
"lifter", DEFAULT_LIFTER);
288 op.
set(
"lpc_order", DEFAULT_LPC_ORDER);
289 op.
set(
"ref_order", DEFAULT_REF_ORDER);
290 op.
set(
"cep_order", DEFAULT_CEP_ORDER);
291 op.
set(
"fbank_order", DEFAULT_FBANK_ORDER);
292 op.
set(
"melcep_order", DEFAULT_MELCEP_ORDER);
294 op.
set(
"max_period", MAXIMUM_PITCH_PERIOD);
295 op.
set(
"min_period", MINIMUM_PITCH_PERIOD);
296 op.
set(
"def_period", DEFAULT_PITCH_PERIOD);
298 if (
al.present(
"-max_period"))
299 op.
set(
"max_period",
al.fval(
"-max_period", 0));
300 if (
al.present(
"-min_period"))
301 op.
set(
"min_period",
al.fval(
"-min_period", 0));
302 if (
al.present(
"-def_period"))
303 op.
set(
"def_period",
al.fval(
"-def_period", 0));
305 if (
al.present(
"-window_type"))
306 op.
set(
"window_type",
al.sval(
"-window_type", 1));
308 if (
al.present(
"-shift"))
309 op.
set(
"frame_shift",
al.fval(
"-shift", 1));
310 if (
al.present(
"-factor"))
311 op.
set(
"frame_factor",
al.fval(
"-factor", 1));
312 if (
al.present(
"-size"))
313 op.
set(
"frame_factor", op.
F(
"frame_factor")*-1.0*
al.fval(
"-size"));
314 if (
al.present(
"-length"))
315 op.
set(
"frame_factor",
316 al.fval(
"-length", est_errors_allowed)/op.
F(
"frame_shift",est_errors_allowed));
318 if (
al.present(
"-preemph"))
319 op.
set(
"preemph",
al.fval(
"-preemph", 1));
320 if (
al.present(
"-lifter"))
321 op.
set(
"lifter",
al.fval(
"-lifter", 1));
323 if (
al.present(
"-lpc_order"))
324 op.
set(
"lpc_order",
al.ival(
"-lpc_order", 1));
325 if (
al.present(
"-ref_order"))
326 op.
set(
"ref_order",
al.ival(
"-ref_order", 1));
327 if (
al.present(
"-cep_order"))
328 op.
set(
"cep_order",
al.ival(
"-cep_order", 1));
329 if (
al.present(
"-fbank_order"))
330 op.
set(
"fbank_order",
al.ival(
"-fbank_order", 1));
331 if (
al.present(
"-melcep_order"))
332 op.
set(
"melcep_order",
al.ival(
"-melcep_order", 1));
334 if (
al.present(
"-usepower"))
335 op.
set(
"usepower",
al.val(
"-usepower", 1));
337 if (
al.present(
"-include_c0"))
338 op.
set(
"include_c0",
al.val(
"-include_c0", 1));
void set(const EST_String &name, int ival)
const float F(const EST_String &path) const
int override_ival(const EST_String rkey, const int rval)
add to end of list or overwrite. If rval is empty, do nothing
static EST_String options_supported(void)
Return a paragraph describing the available windows.