67 w_name = op.
S(
"window_type");
72 f = op.
present(
"frame_factor") ? op.
F(
"frame_factor")
84 else if (delta_order == 1)
86 else if (delta_order == 2)
89 EST_error(
"Requested delta order too high: %d\n", delta_order);
98 int actual_order = op.
I(t +
"_order");
101 cerr <<
"Invalid " << t <<
"_order" <<
" : ";
102 cerr << actual_order;
103 cerr <<
" (using 1 instead) " << endl;
107 int lowest_coef=0,highest_coef=actual_order-1;
113 highest_coef=actual_order;
121 highest_coef=actual_order;
128 if(actual_order == 1)
148 float liftering_parameter=0;
149 bool use_power_rather_than_energy=
false,
take_logs=
true, include_c0=
false;
151 parse_op_settings(op, wf, frame_factor);
158 if( (slist(s) ==
"melcep") && !op.
present(
"include_c0"))
167 cerr <<
"USING POWER" << endl;
169 if ((slist(s) ==
"lpc") || (slist(s) ==
"cep")
170 ||(slist(s) ==
"ref") || (slist(s) ==
"lsf"))
171 sig2coef(sig, fill, slist(s), frame_factor, wf);
172 else if (slist(s) ==
"power")
173 power(sig, fill, frame_factor);
174 else if (slist(s) ==
"energy")
175 energy(sig, fill, frame_factor);
176 else if (slist(s) ==
"f0")
178 op.
set(
"srpd_resize", 0);
179 op.
set(
"pda_frame_shift", op.
F(
"frame_shift"));
180 pda(sig, fill, op,
"srpd");
185 else if (slist(s) ==
"fbank")
187 use_power_rather_than_energy = op.
present(
"usepower");
188 fbank(sig, fill, frame_factor, wf, use_power_rather_than_energy,
192 else if (slist(s) ==
"melcep")
194 fbank_order=op.
I(
"fbank_order");
195 use_power_rather_than_energy = op.
present(
"usepower");
196 include_c0=op.
present(
"include_c0");
199 liftering_parameter=op.
F(
"lifter");
203 melcep(sig, fill, frame_factor, fbank_order,
204 liftering_parameter, wf, include_c0,
205 use_power_rather_than_energy);
208 EST_error(
"Error: Unnknown type of processing requested: %s\n",
209 ((
const char*) slist(s)));
222 if( (k ==
"melcep") && !op.
present(
"include_c0"))
270 if( (k ==
"melcep") && !op.
present(
"include_c0"))
274 else if (fv.
has_channel(k +
"_d_" + start_channel))
318 int i,
int sample_rate,
int prefer_prev)
324 prev = irint((pms.
t(i) - pms.
t(i-1))*sample_rate);
326 next = irint((pms.
t(i+1) - pms.
t(i))*sample_rate);
329 return prev>=0?prev:(next>=0?next:0);
330 return next>=0?next:(prev>=0?prev:0);
339 prev = pms.
t(i) - pms.
t(i-1);
341 next = pms.
t(i+1) - pms.
t(i);
344 return prev>=0 ? prev: (next>=0 ? next : 0.0);
345 return next>=0 ? next: (prev>=0 ? prev : 0.0);
413 start = (irint(tr.
t(k) * sig.
sample_rate()) - (size/2));
425 int window_start, window_size, pos;
438 window_start = pos - window_size/2;
448 int window_start, window_size, pos;
461 window_start = pos - window_size/2;
477 EST_error(
"In track has %d frames, out track has %d\n",
481 tmp = ((in_type ==
"") ? determine_type(in_track.
channel_name(0)):in_type);
486 for (
int i = 0; i < in_track.
num_frames(); ++i)
488 in_track.
frame(in_frame, i);
489 out_track.
frame(out_frame, i);
500 const bool use_power_rather_than_energy,
506 int window_start, window_size, pos, k;
515 EST_error(
"Filterbank order of %i makes no sense.\n",fbank_order);
519 for (k = 0; k < fbank_track.
num_frames(); ++k)
527 window_start = pos - window_size/2;
530 fbank_track.
frame(fbank_frame,k);
532 use_power_rather_than_energy,take_log);
543 float liftering_parameter,
545 const bool include_c0,
546 const bool use_power_rather_than_energy)
566 fbank(sig, fbank_track, factor, wf, use_power_rather_than_energy,
true);
577 mfcc_track.
frame(mfcc_frame,k);
578 fbank_track.
frame(fbank_frame,k);
580 fbank2melcep(fbank_frame, mfcc_frame,liftering_parameter,include_c0);
A class for storing digital waveforms. The waveform is stored as an array of 16 bit shorts...
#define DEFAULT_FRAME_FACTOR
int contains(const char *s, ssize_t pos=-1) const
Does it contain this substring?
static Func * creator(const char *name, bool report_error=false)
Return the creation function for the given window type.
void delta(EST_Track &tr, EST_Track &d, int regression_length=3)
void convert_track(EST_Track &in_track, EST_Track &out_track, const EST_String &out_type, const EST_String &in_type)
static void window_signal(const EST_Wave &sig, EST_WindowFunc *make_window, int start, int size, EST_TBuffer< float > &frame)
A vector class for floating point numbers. EST_FVector x should be used instead of float *x wherever ...
int num_channels() const
return number of channels in track
void energy(EST_Wave &sig, EST_Track &pow, float factor)
EST_String itoString(int n)
Make a EST_String object from an integer.
void sig2pow(EST_FVector &frame, float &power)
void power(EST_Wave &sig, EST_Track &pow, float factor)
void set(const EST_String &name, int ival)
void resize(ssize_t num_frames, int num_channels, bool preserve=1)
void melcep(EST_Wave &sig, EST_Track &mfcc_track, float factor, int fbank_order, float liftering_parameter, EST_WindowFunc *wf, const bool include_c0, const bool use_power_rather_than_energy)
void sig2coef(EST_Wave &sig, EST_Track &tr, EST_String type, float factor, EST_WindowFunc *wf)
void sub_track(EST_Track &st, int start_frame=0, int nframes=EST_ALL, int start_chan=0, int nchans=EST_ALL)
const EST_String S(const EST_String &path) const
void fbank2melcep(const EST_FVector &fbank_vec, EST_FVector &mfcc, const float liftering_parameter, const bool include_c0=false)
int get_frame_size(EST_Track &pms, int i, int sample_rate, int prefer_prev)
float & t(ssize_t i=0)
return time position of frame i
float & a(ssize_t i, int c=0)
void sig2rms(EST_FVector &frame, float &rms_energy)
void add_channels_to_map(EST_StrList &map, EST_StrList &types, EST_Features &op, int delta_order)
void sigpr_delta(EST_Wave &sig, EST_Track &fv, EST_Features &op, const EST_StrList &slist)
int present(const EST_String &name) const
void frame_convert(const EST_FVector &in_frame, const EST_String &in_type, EST_FVector &out_frame, const EST_String &out_type)
ssize_t num_frames() const
return number of frames in track
void EST_WindowFunc(int size, EST_TBuffer< float > &r_window, int window_centre)
Function which creates a window.
void append(const T &item)
add item onto end of list
void pda(EST_Wave &sig, EST_Track &fz, EST_Features &op, EST_String method="")
void sigpr_acc(EST_Wave &sig, EST_Track &fv, EST_Features &op, const EST_StrList &slist)
const EST_String channel_name(int channel, const EST_ChannelNameMap &map, int strings_override=1) const
int sample_rate() const
return the sampling rate (frequency)
void sig2fbank(const EST_FVector &sig, EST_FVector &fbank_frame, const float sample_rate, const bool use_power_rather_than_energy, const bool take_log)
float start(const EST_Item &item)
#define DEFAULT_WINDOW_NAME
int I(const EST_String &path) const
float get_time_frame_size(EST_Track &pms, int i, int prefer_prev)
EST_String before(int pos, int len=0) const
Part before position.
bool has_channel(const char *name) const
void frame(EST_FVector &fv, int n, int startf=0, int nf=EST_ALL)
void set_equal_space(bool t)
void fbank(EST_Wave &sig, EST_Track &fbank_track, const float factor, EST_WindowFunc *wf, const bool use_power_rather_than_energy, const bool take_log)
void fill_time(float t, int start=1)
float F(const EST_String &path) const
void sigpr_base(EST_Wave &sig, EST_Track &fv, EST_Features &op, const EST_StrList &slist)
Utility EST_String Functions header file.