41 #include "EST_cmd_line_options.h" 42 #include "sigpr/EST_spectrogram.h" 44 #define DEFAULT_FRAME_SIZE 0.001 45 #define DEFAULT_FRAME_LENGTH 0.008 46 #define DEFAULT_ORDER 256 47 #define DEFAULT_PREEMPH 0.94 90 int main(
int argc,
char *argv[])
103 EST_String(
"[input file] -o [output file]\n")+
104 "Summary: make spectrogram\n"+
105 "use \"-\" to make input and output files stdin/out\n"+
107 options_wave_input()+
109 options_track_output()+
110 "-shift <float> frame spacing in seconds for fixed frame analysis. This \n" 111 " doesn't have to be the same as the output file spacing - the \n" 112 " S option can be used to resample the track before saving \n" 113 " default: "+ftoString(DEFAULT_FRAME_SIZE) +
"\n\n" 114 "-length <float> input frame length in milliseconds\n"+
115 "-sr <float> range in which output values should lie\n"+
116 "-slow slow FFT code\n"+
117 "-w <float> white cut off (0.0 to 1.0)\n"+
118 "-b <float> black cut off (0.0 to 1.0)\n"+
119 "-raw Don't perform any scaling\n"+
120 "-order <int> cepstral order\n", files, al);
125 if (read_wave(sig, files.
first(), al) != format_ok)
129 make_spectrogram(sig, spec, op);
131 spec.
save(out_file, al.
val(
"-otype", 0));
138 op.
set(
"frame_shift", DEFAULT_FRAME_SIZE);
139 op.
set(
"frame_length", DEFAULT_FRAME_LENGTH);
140 op.
set(
"preemph", DEFAULT_PREEMPH);
141 op.
set(
"frame_order", DEFAULT_ORDER);
144 op.
set(
"frame_shift", al.
fval(
"-shift"));
147 op.
set(
"frame_length", al.
fval(
"-length"));
150 op.
set(
"frame_order", al.
fval(
"-order"));
153 op.
set(
"sp_range", al.
fval(
"-sr"));
156 op.
set(
"sp_wcut", al.
fval(
"-w"));
159 op.
set(
"sp_bcut", al.
fval(
"-b"));
162 op.
set(
"preemph", al.
fval(
"-preemph", 1));
float fval(const EST_String &rkey, int m=1) const
void set(const EST_String &name, int ival)
EST_write_status save(const EST_String name, const EST_String EST_filetype="")
const T & first() const
return const reference to first item in list
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)
int sample_rate() const
return the sampling rate (frequency)