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
53 int main(
int argc,
char *argv[])
67 "Summary: make spectrogram\n"+
68 "use \"-\" to make input and output files stdin/out\n"+
72 options_track_output()+
73 "-shift <float> frame spacing in seconds for fixed frame analysis. This \n"
74 " doesn't have to be the same as the output file spacing - the \n"
75 " S option can be used to resample the track before saving \n"
76 " default: "+
ftoString(DEFAULT_FRAME_SIZE) +
"\n\n"
77 "-length <float> input frame length in milliseconds\n"+
78 "-sr <float> range in which output values should lie\n"+
79 "-slow slow FFT code\n"+
80 "-w <float> white cut off (0.0 to 1.0)\n"+
81 "-b <float> black cut off (0.0 to 1.0)\n"+
82 "-raw Don't perform any scaling\n"+
83 "-order <int> cepstral order\n", files, al);
88 if (read_wave(sig, files.
first(), al) != format_ok)
92 make_spectrogram(sig, spec, op);
94 spec.
save(out_file, al.
val(
"-otype", 0));
101 op.
set(
"frame_shift", DEFAULT_FRAME_SIZE);
102 op.
set(
"frame_length", DEFAULT_FRAME_LENGTH);
103 op.
set(
"preemph", DEFAULT_PREEMPH);
104 op.
set(
"frame_order", DEFAULT_ORDER);
107 op.
set(
"frame_shift", al.
fval(
"-shift"));
110 op.
set(
"frame_length", al.
fval(
"-length"));
113 op.
set(
"frame_order", al.
fval(
"-order"));
116 op.
set(
"sp_range", al.
fval(
"-sr"));
119 op.
set(
"sp_wcut", al.
fval(
"-w"));
122 op.
set(
"sp_bcut", al.
fval(
"-b"));
125 op.
set(
"preemph", al.
fval(
"-preemph", 1));
A class for storing digital waveforms. The waveform is stored as an array of 16 bit shorts...
float fval(const EST_String &rkey, int m=1) const
void set(const EST_String &name, int ival)
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_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)