50 #define EPSILON (0.0001) 52 #define DEFAULT_FRAME_SIZE 0.01 53 #define DEFAULT_FRAME_FACTOR 2.0 54 #define DEFAULT_LPC_ORDER 16 55 #define DEFAULT_REF_ORDER 16 56 #define DEFAULT_CEP_ORDER 12 57 #define DEFAULT_FBANK_ORDER 20 58 #define DEFAULT_MELCEP_ORDER 12 59 #define DEFAULT_WINDOW "hamming" 60 #define DEFAULT_PREEMPH 0 61 #define DEFAULT_LIFTER 0 66 #define MINIMUM_PITCH_PERIOD (0.0033) // 300 hz 67 #define MAXIMUM_PITCH_PERIOD (0.02) // 50 Hz 68 #define DEFAULT_PITCH_PERIOD (0.01) // 100 Hz 82 " lpc linear predictive coding\n" 83 " cep cepstrum coding from lpc coefficients\n" 84 " melcep Mel scale cepstrum coding via fbank\n" 85 " fbank Mel scale log filterbank analysis\n" 86 " lsf line spectral frequencies\n" 87 " ref Linear prediction reflection coefficients\n" 90 " energy: root mean square energy\n";
95 int main(
int argc,
char *argv[])
103 EST_StrList coef_list, delta_list, acc_list, tlist, map;
108 EST_String(
"[input file] -o [output file]\n")+
109 "Summary: generate acoustic feature vectors for a waveform file \n" 110 "use \"-\" to make input and output files stdin/out \n" 111 "-h Options help \n\n" +
114 "-shift <float> frame spacing in seconds for fixed frame analysis. This \n" 115 " doesn't have to be the same as the output file spacing - the \n" 116 " S option can be used to resample the track before saving \n" 118 "-factor <float> Frames lengths will be FACTOR times the \n" 119 " local pitch period. \n" 121 "-pm <ifile> Pitch mark file name. This is used to \n" 122 " specify the positions of the analysis frames for pitch \n" 123 " synchronous analysis. Pitchmark files are just standard \n" 124 " track files, but the channel information is ignored and \n" 125 " only the time positions are used\n" 126 "-size <float> If specified with pm, size is used as the \n" 127 " fixed window size (times factor) rather than size within \n" 130 "-coefs <string> list of basic types of processing required. \n" 132 "-delta <string> list of delta types of processing required. Basic \n" 133 " processing does not need to be specified for this option to work. \n" 135 "-acc <string> list of acceleration (delta delta) processing \n" 136 " required. Basic processing does not need to be specified for \n" 137 " this option to work. \n" 138 " Permissable types are: \n" 140 "-window_type <string> Type of window used on waveform. \n" 141 " Permissable types are: \n" +
144 "-lpc_order <int> Order of lpc analysis. \n\n" 145 "-ref_order <int> Order of lpc reflection coefficient analysis. \n\n" 146 "-cep_order <int> Order of lpc cepstral analysis.\n\n" 147 "-melcep_order <int> Order of Mel cepstral analysis.\n\n" 148 "-fbank_order <int> Order of filter bank analysis.\n\n" 149 "-preemph <float> Perform pre-emphasis with this factor.\n\n" 150 "-lifter <float> lifter coefficient.\n\n" 151 "-usepower use power rather than energy in filter bank \n" 153 "-include_c0 include cepstral coefficient 0\n\n" 154 "-order <string> order of analyses\n", files, al);
177 full.
resize((
int)ceil(sig.
end() / op.
F(
"frame_shift")), 0);
194 cerr <<
"sig2fv: -usepower currently not supported" << endl;
202 cout <<
"-S " << al.
fval(
"-S") << endl;
208 cerr <<
"sig2fv: failed to write output to \"" << out_file
224 for (c = clist.
head(), o = olist.
head(); c && o; c= c->
next(), o = o->
next())
226 k = clist(c) +
"_order";
252 op.
set(
"max_period", al.
fval(
"-max_period", 0));
254 op.
set(
"min_period", al.
fval(
"-min_period", 0));
256 op.
set(
"def_period", al.
fval(
"-def_period", 0));
258 if (al.
present(
"-window_type"))
259 op.
set(
"window_type", al.
sval(
"-window_type", 1));
262 op.
set(
"frame_shift", al.
fval(
"-shift", 1));
264 op.
set(
"frame_factor", al.
fval(
"-factor", 1));
266 op.
set(
"frame_factor", op.
F(
"frame_factor")*-1.0*al.
fval(
"-size"));
268 op.
set(
"frame_factor",
272 op.
set(
"preemph", al.
fval(
"-preemph", 1));
274 op.
set(
"lifter", al.
fval(
"-lifter", 1));
277 op.
set(
"lpc_order", al.
ival(
"-lpc_order", 1));
279 op.
set(
"ref_order", al.
ival(
"-ref_order", 1));
281 op.
set(
"cep_order", al.
ival(
"-cep_order", 1));
282 if (al.
present(
"-fbank_order"))
283 op.
set(
"fbank_order", al.
ival(
"-fbank_order", 1));
284 if (al.
present(
"-melcep_order"))
285 op.
set(
"melcep_order", al.
ival(
"-melcep_order", 1));
288 op.
set(
"usepower", al.
val(
"-usepower", 1));
291 op.
set(
"include_c0", al.
val(
"-include_c0", 1));
A class for storing digital waveforms. The waveform is stored as an array of 16 bit shorts...
#define MAXIMUM_PITCH_PERIOD
void pre_emphasis(EST_Wave &sig, float a=DEFAULT_PRE_EMPH_FACTOR)
void add_channels_to_map(EST_StrList &map, EST_StrList &types, EST_Features &op, int order)
The file was read in successfully.
#define DEFAULT_CEP_ORDER
int override_ival(const EST_String rkey, const int 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.
#define DEFAULT_LPC_ORDER
float fval(const EST_String &rkey, int m=1) const
static EST_String options_supported(void)
Return a paragraph describing the available windows.
void set(const EST_String &name, int ival)
void resize(ssize_t num_frames, int num_channels, bool preserve=1)
int main(int argc, char *argv[])
#define DEFAULT_FBANK_ORDER
EST_String ftoString(float n, int pres=3, int width=0, int l=0)
Make a EST_String object from an float, with variable precision.
EST_String sigpr_options_supported(void)
const EST_String & sval(const EST_String &rkey, int m=1) const
#define DEFAULT_MELCEP_ORDER
#define DEFAULT_FRAME_SIZE
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...
The file was written successfully.
void sigpr_delta(EST_Wave &sig, EST_Track &fv, EST_Features &op, const EST_StrList &slist)
EST_write_status save(const EST_String name, const EST_String EST_filetype="")
void calculate_orders(EST_StrList &clist, EST_IList &olist, EST_Option &op)
const T & first() const
return const reference to first item in list
EST_String options_wave_input(void)
const V & val(const K &rkey, bool m=0) const
return value according to key (const)
void sigpr_acc(EST_Wave &sig, EST_Track &fv, EST_Features &op, const EST_StrList &slist)
float end()
return the time position of the last sample.
int read_track(EST_Track &tr, const EST_String &in_file, EST_Option &al)
EST_String options_track_output(void)
#define MINIMUM_PITCH_PERIOD
EST_read_status read_wave(EST_Wave &sig, const EST_String &in_file, EST_Option &al)
#define DEFAULT_PITCH_PERIOD
int present(const K &rkey) const
Returns true if key is present.
#define DEFAULT_FRAME_FACTOR
int parse_command_line(int argc, char *argv[], const EST_String &usage, EST_StrList &files, EST_Option &al, int make_stdio=1)
void set_options(EST_Features &op, EST_Option &al)
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)
#define DEFAULT_REF_ORDER
Utility EST_String Functions header file.