79 sig.
a(i) = sig.
a(i + 1) - sig.
a(i);
88 if (&single == &multi)
101 short *buf =
new short [num_samples];
108 for (i = 0, p = ch_list.
head(); p; p = p->
next(), ++i)
110 channel = ch_list(p);
112 if (channel < 0 || channel >= c)
113 EST_error(
"Can't extract channel %d from %d channel waveform\n",
124 if (&single == &multi)
136 if (channel < 0 || channel >= c)
138 cerr <<
"Can't extract channel " << channel <<
" from " <<
139 c <<
" channel waveform\n";
147 single.
copy(subwave);
186 s.
resize(new_samples, new_channels, 1);
190 s.
a(i, j) += m.
a(i, j);
204 for (i = 0; i < n; ++i)
220 from = al.
ival(
"-from");
231 sig.
sub_wave(sub_wave, from, to - from);
239 cout <<
"Duration: " <<
242 cout <<
"Sample rate: " << w.
sample_rate() << endl;
243 cout <<
"Number of samples: " << w.
num_samples() << endl;
244 cout <<
"Number of channels: " << w.
num_channels() << endl;
245 cout <<
"Header type: " << w.
file_type() << endl;
249 static EST_String options_wave_filetypes(
void)
255 return "nist, est, esps, snd, riff, aiff, audlab, raw, ascii";
262 "-start <float> Extract sub-wave starting at this time, specified in \n" 264 "-end <float> Extract sub-wave ending at this time, specified in \n" 266 "-from <int> Extract sub-wave starting at this sample point\n\n" 267 "-to <int> Extract sub-wave ending at this sample point\n\n";
274 "-itype <string> Input file type (optional). If set to raw, this \n" 275 " indicates that the input file does not have a header. While \n" 276 " this can be used to specify file types other than raw, this is \n" 277 " rarely used for other purposes\n" 278 " as the file type of all the existing supported \n" 279 " types can be determined automatically from the \n" 280 " file's header. If the input file is unheadered, \n" 281 " files are assumed to be shorts (16bit). \n" 282 " Supported types are \n" 283 " "+options_wave_filetypes()+
"\n\n" 284 "-n <int> Number of channels in an unheadered input file \n\n" 285 "-f <int> Sample rate in Hertz for an unheadered input file \n\n" 286 "-ibo <string> Input byte order in an unheadered input file: \n" 287 " possibliities are: MSB , LSB, native or nonnative. \n" 288 " Suns, HP, SGI Mips, M68000 are MSB (big endian) \n" 289 " Intel, Alpha, DEC Mips, Vax are LSB (little \n" 291 "-iswap Swap bytes. (For use on an unheadered input file)\n\n" 292 "-istype <string> Sample type in an unheadered input file:\n" 293 " short, alaw, mulaw, byte, ascii\n\n" 294 "-c <string> Select a single channel (starts from 0). \n" 295 " Waveforms can have multiple channels. This option \n" 296 " extracts a single channel for progcessing and \n" 297 " discards the rest. \n\n"+
311 "-o <ofile> Output filename. If not specified output is\n" 313 "-otype <string> Output file type, (optional). If no type is\n" 314 " Specified the type of the input file is assumed.\n" 315 " Supported types are: \n" 316 " "+options_wave_filetypes()+
"\n\n" 317 "-F <int> Output sample rate in Hz. If this is different \n" 318 " from the input sample rate, resampling will occur \n\n" 319 "-obo <string> Output byte order: MSB, LSB, native, or nonnative. \n" 320 " Suns, HP, SGI Mips, M68000 are MSB (big endian) \n" 321 " Intel, Alpha, DEC Mips, Vax are LSB \n" 322 " (little endian)\n\n" 323 "-oswap Swap bytes when saving to output\n\n"+
324 "-ostype <string> Output sample type: short, alaw, mulaw, byte or ascii\n\n";
328 #if defined(INSTANTIATE_TEMPLATES) 329 #include "../base_class/EST_TNamedEnum.cc" A class for storing digital waveforms. The waveform is stored as an array of 16 bit shorts...
void set_sample_rate(const int n)
Set sampling rate to n
void invert(EST_Wave &sig)
void wave_info(EST_Wave &w)
Utility IO Function header file.
void add_waves(EST_Wave &s, const EST_Wave &m)
int ival(const EST_String &rkey, int m=1) const
EST_TNamedEnum< EST_sample_type_t > EST_sample_type_map(st_names)
void copy(const EST_Wave &from)
void set_file_type(const EST_String t)
float fval(const EST_String &rkey, int m=1) const
ssize_t num_samples() const
return the number of samples in the waveform
void extract_channels(EST_Wave &single, const EST_Wave &multi, EST_IList &ch_list)
#define VAL_REGISTER_CLASS(NAME, CLASS)
int wave_extract_channel(EST_Wave &single, const EST_Wave &multi, int channel)
void rescale(float gain, int normalize=0)
short & a(ssize_t i, ssize_t channel=0)
void sub_wave(EST_Wave &sw, int offset=0, ssize_t num=EST_ALL, ssize_t start_c=0, ssize_t nchan=EST_ALL)
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 file_type() const
EST_String options_wave_output(void)
void set_channel(ssize_t n, const short *buf, int offset=0, ssize_t num=EST_ALL)
EST_String options_subwave(void)
INLINE short & a_no_check(ssize_t i, ssize_t channel=0)
void copy_channel(ssize_t n, short *buf, int offset=0, ssize_t num=EST_ALL) const
void append(const T &item)
add item onto end of list
#define Declare_TNamedEnum(ENUM)
void resize(int num_samples, int num_channels=EST_ALL, int set=1)
resize the waveform
void reverse(EST_Wave &sig)
int sample_rate() const
return the sampling rate (frequency)
void wave_combine_channels(EST_Wave &s, const EST_Wave &m)
void differentiate(EST_Wave &sig)
int present(const K &rkey) const
Returns true if key is present.
ssize_t num_channels() const
return the number of channels in the waveform
void extract(EST_Wave &sig, EST_Option &al)
EST_String options_wave_input(void)
float sum(const EST_FMatrix &a)
sum of elements
EST_String sample_type() const
#define Instantiate_TNamedEnum(ENUM)
Utility EST_String Functions header file.