44 #include "EST_cmd_line.h"
45 #include "EST_cmd_line_options.h"
46 #include "EST_sigpr.h"
47 #include "EST_wave_aux.h"
57 int main (
int argc,
char *argv[])
60 EST_String in_file(
"-"), out_file(
"-"), op_file(
""), test;
67 EST_String(
"[input file0] -o [output file]\n") +
68 "Summary: filter waveform files\n"
69 "use \"-\" to make input and output files stdin/out\n"
71 options_wave_input()+
"\n"+
72 options_wave_output()+
"\n"
73 "-scale <float> Scaling factor. Increase or descrease the amplitude\n"
74 " of the whole waveform by the factor given\n\n"
76 "-scaleN <float> Scaling factor with normalization. \n"
77 " The waveform is scaled to its maximum level, after which \n"
78 " it is scaled by the factor given\n\n"
79 "-double Perform double filtering by applying a forward filter,\n"
80 " then a backward filter, leaving the filtered signla in phase\n"
81 " with the original\n\n"
82 "-lpfilter <int> Low pass filter, with cutoff frequency in Hz \n"
83 " Filtering is performed by a FIR filter which is built at run \n"
84 " time. The order of the filter can be given by -forder. The \n"
85 " default value is 199\n\n"
87 "-hpfilter <int> High pass filter, with cutoff frequency in Hz \n"
88 " Filtering is performed by a FIR filter which is \n"
89 " built at run time. The order of the filter can \n"
90 " be given by -forder. The default value is 199.\n\n"
92 "-forder <int> Order of FIR filter used for lpfilter and \n"
93 " hpfilter. This must be ODD. Sensible values range \n"
94 " from 19 (quick but with a shallow rolloff) to 199 \n"
95 " (slow but with a steep rolloff). The default is 199.\n\n"
96 "-lpcfilter <ifile> Track file containing lpc filter coefficients\n\n"
97 "-firfilter <ifile> File containing a single set of FIR filter\n"
99 "-inv_filter use filter coefficients for inverse filtering\n\n",
104 if (read_wave(sig, files.
first(), al) != format_ok)
109 float scale = al.
fval(
"-s", 0);
112 else if (al.
present(
"-scaleN"))
114 float scale = al.
fval(
"-scaleN", 0);
115 if ((scale < 0) || (scale > 1.0))
117 cerr <<
"ch_wave: -scaleN must be in range 0 to 1" << endl;
139 filter.
load(al.
val(
"-lpcfilter"));
144 cout <<
"not done yet\n";
149 firfilter.
load(al.
val(
"-firfilter"));
156 if (write_wave(fsig, out_file, al) != write_ok)
158 cerr <<
"sigfilter: failed to write output to \"" << out_file
A class for storing digital waveforms. The waveform is stored as an array of 16 bit shorts...
const T & first() const
return const reference to first item in list
void FIRfilter(EST_Wave &in_sig, const EST_FVector &numerator, int delay_correction=0)
EST_read_status load(const EST_String &filename)
load vector from file filename.
A vector class for floating point numbers. EST_FVector x should be used instead of float *x wherever ...
int ival(const EST_String &rkey, int m=1) const
void FIRlowpass_filter(EST_Wave &sigin, int freq, int order=DEFAULT_FILTER_ORDER)
float fval(const EST_String &rkey, int m=1) const
void rescale(float gain, int normalize=0)
void FIR_double_filter(EST_Wave &in_sig, EST_Wave &out_sig, const EST_FVector &numerator)
EST_read_status load(const EST_String name, float ishift=0.0, float startt=0.0)
void inv_lpc_filter_ola(EST_Wave &in_sig, EST_Track &lpc, EST_Wave &out_sig)
const int present(const K &rkey) const
Returns true if key is present.
void FIRhighpass_filter(EST_Wave &in_sig, int freq, int order)
const V & val(const K &rkey, bool m=0) const
return value according to key (const)