42#include "EST_track_aux.h"
43#include "EST_inline_utils.h"
44#include "sigpr/EST_fft.h"
45#include "sigpr/EST_sigpr_frame.h"
46#include "sigpr/EST_sigpr_utt.h"
48#include "EST_Features.h"
50#include "EST_string_aux.h"
60static void parse_op_settings(
EST_Features &op, EST_WindowFunc *&
wf,
float &f)
67 w_name = DEFAULT_WINDOW_NAME;
70 f = op.
present(
"frame_factor") ? op.
F(
"frame_factor")
71 : DEFAULT_FRAME_FACTOR;
87 EST_error(
"Requested delta order too high: %d\n",
delta_order);
99 cerr <<
"Invalid " << t <<
"_order" <<
" : ";
101 cerr <<
" (using 1 instead) " <<
endl;
156 if( (
slist(s) ==
"melcep") && !op.
present(
"include_c0"))
159 if (
fv.has_channel(k))
160 fv.sub_track(fill, 0, EST_ALL, k , 1);
167 if ((
slist(s) ==
"lpc") || (
slist(s) ==
"cep")
170 else if (
slist(s) ==
"power")
172 else if (
slist(s) ==
"energy")
174 else if (
slist(s) ==
"f0")
176 op.
set(
"srpd_resize", 0);
177 op.
set(
"pda_frame_shift", op.
F(
"frame_shift"));
178 pda(
sig, fill, op,
"srpd");
183 else if (
slist(s) ==
"fbank")
190 else if (
slist(s) ==
"melcep")
206 EST_error(
"Error: Unnknown type of processing requested: %s\n",
207 ((
const char*)
slist(s)));
220 if( (k ==
"melcep") && !op.
present(
"include_c0"))
223 if (
fv.has_channel(k))
224 fv.sub_track(
base, 0, EST_ALL, k , 1);
237 base.set_equal_space(
false);
243 if (
fv.has_channel(k +
"_d"))
244 fv.sub_track(fill, 0, EST_ALL, k+
"_d", 1);
268 if( (k ==
"melcep") && !op.
present(
"include_c0"))
270 if (
fv.has_channel(k+
"_d"))
271 fv.sub_track(
base, 0, EST_ALL, k +
"_d", 1);
283 base.set_equal_space(
false);
287 if (
fv.has_channel(k +
"_a"))
288 fv.sub_track(fill, 0, EST_ALL, k+
"_a", 1);
322 prev = irint((
pms.t(i) -
pms.t(i-1))*sample_rate);
323 if (i<
pms.num_frames()-1)
324 next = irint((
pms.t(i+1) -
pms.t(i))*sample_rate);
327 return prev>=0?prev:(next>=0?next:0);
328 return next>=0?next:(prev>=0?prev:0);
337 prev =
pms.t(i) -
pms.t(i-1);
338 if (i <
pms.num_frames() -1)
339 next =
pms.t(i+1) -
pms.t(i);
342 return prev>=0 ? prev: (next>=0 ? next : 0.0);
343 return next>=0 ? next: (prev>=0 ? prev : 0.0);
405 for (
int k = 0; k <
tr.num_frames(); ++k)
408 size = (int)(-1.0 *
factor * (
float)
sig.sample_rate());
410 size = irint(get_frame_size(
tr, k,
sig.sample_rate())*
factor);
411 start = (irint(
tr.t(k) *
sig.sample_rate()) - (size/2));
416 frame_convert(frame,
"sig",
coefs, type);
427 for (k = 0; k <
pow.num_frames(); ++k)
429 pos = irint(
pow.t(k) *
sig.sample_rate());
438 sig2pow(frame,
pow.a(k));
449 for (k = 0; k <
pow.num_frames(); ++k)
451 pos = irint(
pow.t(k) *
sig.sample_rate());
460 sig2rms(frame,
pow.a(k));
473 EST_error(
"In track has %d frames, out track has %d\n",
482 for (
int i = 0; i <
in_track.num_frames(); ++i)
511 EST_error(
"Filterbank order of %i makes no sense.\n",
fbank_order);
void set(const EST_String &name, int ival)
const float F(const EST_String &path) const
const EST_String S(const EST_String &path) const
int present(const EST_String &name) const
const int I(const EST_String &path) const
void append(const T &item)
add item onto end of list
static void window_signal(const EST_Wave &sig, EST_WindowFunc *make_window, int start, int size, EST_TBuffer< float > &frame)
static Func * creator(const char *name, bool report_error=false)
Return the creation function for the given window type.