59 int main (
int argc,
char *argv[])
62 EST_String in_file(
"-"), out_file(
"-"), op_file(
""), test;
69 EST_String(
"[input file0] -o [output file]\n") +
70 "Summary: filter waveform files\n" 71 "use \"-\" to make input and output files stdin/out\n" 75 "-scale <float> Scaling factor. Increase or descrease the amplitude\n" 76 " of the whole waveform by the factor given\n\n" 78 "-scaleN <float> Scaling factor with normalization. \n" 79 " The waveform is scaled to its maximum level, after which \n" 80 " it is scaled by the factor given\n\n" 81 "-double Perform double filtering by applying a forward filter,\n" 82 " then a backward filter, leaving the filtered signla in phase\n" 83 " with the original\n\n" 84 "-lpfilter <int> Low pass filter, with cutoff frequency in Hz \n" 85 " Filtering is performed by a FIR filter which is built at run \n" 86 " time. The order of the filter can be given by -forder. The \n" 87 " default value is 199\n\n" 89 "-hpfilter <int> High pass filter, with cutoff frequency in Hz \n" 90 " Filtering is performed by a FIR filter which is \n" 91 " built at run time. The order of the filter can \n" 92 " be given by -forder. The default value is 199.\n\n" 94 "-forder <int> Order of FIR filter used for lpfilter and \n" 95 " hpfilter. This must be ODD. Sensible values range \n" 96 " from 19 (quick but with a shallow rolloff) to 199 \n" 97 " (slow but with a steep rolloff). The default is 199.\n\n" 98 "-lpcfilter <ifile> Track file containing lpc filter coefficients\n\n" 99 "-firfilter <ifile> File containing a single set of FIR filter\n" 101 "-inv_filter use filter coefficients for inverse filtering\n\n",
111 float scale = al.
fval(
"-s", 0);
114 else if (al.
present(
"-scaleN"))
116 float scale = al.
fval(
"-scaleN", 0);
117 if ((scale < 0) || (scale > 1.0))
119 cerr <<
"ch_wave: -scaleN must be in range 0 to 1" << endl;
141 filter.
load(al.
val(
"-lpcfilter"));
146 cout <<
"not done yet\n";
151 firfilter.
load(al.
val(
"-firfilter"));
160 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...
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)
void frame_filter(EST_Wave &sig, EST_Track &lpc, EST_Wave &res)
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)
The file was written successfully.
const T & first() const
return const reference to first item in list
EST_String options_wave_input(void)
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)
int main(int argc, char *argv[])
EST_write_status write_wave(EST_Wave &sig, const EST_String &in_file, EST_Option &al)
EST_read_status read_wave(EST_Wave &sig, const EST_String &in_file, EST_Option &al)
EST_String options_wave_output(void)
int present(const K &rkey) const
Returns true if key is present.
void inv_filter_ola(EST_Wave &sig, EST_Track &lpc, EST_Wave &res)
int parse_command_line(int argc, char *argv[], const EST_String &usage, EST_StrList &files, EST_Option &al, int make_stdio=1)