90 short *memory,
int offset=0,
int sample_rate=default_sample_rate,
91 int free_when_destroyed=0);
124 {
return a(i,channel); }
137 float t(
ssize_t i)
const {
return (
float)i/(float)p_sample_rate; }
194 void rescale(
float gain,
int normalize=0);
212 { p_values.
row(sv, n); }
214 { p_values.
column(cv, n); }
219 { p_values.
copy_row(n, buf, offset, num); }
224 { p_values.
set_row(n, buf, offset, num); }
234 { ((
EST_Wave *)
this)->sub_wave(sw, offset, num, start_c, nchan); }
249 int rate = default_sample_rate);
254 int rate = default_sample_rate);
260 int rate = default_sample_rate);
266 int rate = default_sample_rate);
296 EST_String sample_type,
int bo,
const char *mode =
"wb");
A class for storing digital waveforms. The waveform is stored as an array of 16 bit shorts...
EST_Wave & operator+=(const EST_Wave &a)
void copy_setup(const EST_Wave &w)
void set_column(ssize_t n, const T *buf, ptrdiff_t offset=0, int num=-1)
void set_sample_rate(const int n)
Set sampling rate to n
bool have_rows_before(ssize_t n) const
void sample(EST_TVector< short > &sv, ssize_t n)
EST_write_status save_file_data(FILE *fp, EST_String ftype, EST_String stype, int obo)
void copy_sample(ssize_t n, short *buf, int offset=0, ssize_t num=EST_ALL) const
void copy_column(ssize_t c, T *buf, ptrdiff_t offset=0, int num=-1) const
ssize_t num_columns() const
return number of columns
INLINE short & a_no_check_1(ssize_t i, ssize_t channel=0)
void set_row(ssize_t n, const T *buf, ptrdiff_t offset=0, int num=-1)
ssize_t length() const
return the size of the waveform, i.e. the number of samples.
void copy(const EST_Wave &from)
void set_file_type(const EST_String t)
void sub_wave(EST_Wave &sw, int offset=0, ssize_t num=EST_ALL, ssize_t start_c=0, ssize_t nchan=EST_ALL) const
void set_name(const EST_String n)
Sets name.
ssize_t num_rows() const
return number of rows
ssize_t num_samples() const
return the number of samples in the waveform
short operator()(ssize_t i) const
void rescale(float gain, int normalize=0)
short & a(ssize_t i, ssize_t channel=0)
EST_write_status save(const EST_String filename, const EST_String EST_filetype="")
void channel(EST_TVector< short > &cv, ssize_t n)
INLINE const T & a_no_check_1(ssize_t row, ssize_t col) const
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_Wave()
default constructor
EST_Wave & operator=(const EST_Wave &w)
Assignment operator.
void column(EST_TVector< T > &cv, ssize_t c, ssize_t start_r=0, int len=-1)
Make the vector cv a window onto column c
short & a_safe(ssize_t i, ssize_t channel=0)
EST_String file_type() const
static const int default_sample_rate
EST_write_status save_file(const EST_String filename, EST_String filetype, EST_String sample_type, int bo, const char *mode="wb")
bool have_left_context(unsigned int n) const
Can we look N samples to the left?
EST_read_status load_file(const EST_String filename, const EST_String filetype, int sample_rate, const EST_String sample_type, int bo, ssize_t nc, int offset=0, ssize_t length=0)
void default_vals(ssize_t n=0, ssize_t c=1)
void set_channel(ssize_t n, const short *buf, int offset=0, ssize_t num=EST_ALL)
const EST_SMatrix & values() const
void set_sample(ssize_t n, const short *buf, int offset=0, ssize_t num=EST_ALL)
INLINE short & a_no_check(ssize_t i, ssize_t channel=0)
EST_String name() const
A string identifying the waveform, commonly used to store the filename.
friend ostream & operator<<(ostream &p_values, const EST_Wave &sig)
print waveform
void copy_channel(ssize_t n, short *buf, int offset=0, ssize_t num=EST_ALL) const
INLINE short set_a(ssize_t i, ssize_t channel=0, short val=0)
void row(EST_TVector< T > &rv, ssize_t r, ssize_t start_c=0, int len=-1)
Make the vector rv a window onto row r
void copy_row(ssize_t r, T *buf, ptrdiff_t offset=0, int num=-1) const
INLINE short a_no_check_1(ssize_t i, ssize_t channel=0) const
float end()
return the time position of the last sample.
void resize(int num_samples, int num_channels=EST_ALL, int set=1)
resize the waveform
void empty(ssize_t channel=EST_ALL)
int sample_rate() const
return the sampling rate (frequency)
static const ssize_t default_num_channels
int operator!=(EST_Wave a, EST_Wave b)
EST_write_status save_file_header(FILE *fp, EST_String ftype, EST_String stype, int obo)
EST_TList< EST_Wave > EST_WaveList
float t(ssize_t i) const
return the time position in seconds of the ith sample
ssize_t num_channels() const
return the number of channels in the waveform
int operator==(EST_Wave a, EST_Wave b)
INLINE const T & a_no_check(ssize_t row, ssize_t col) const
const access with no bounds check, care recommend
void resize(int rows, int cols, int set=1)
resize matrix
EST_Wave & operator|=(const EST_Wave &a)
void clear()
clear waveform and set size to 0.
void resample(int rate)
Resample waveform to rate
void copy_data(const EST_Wave &w)
EST_String sample_type() const
EST_String f_String(const char *name, const EST_String &def) const
short operator()(ssize_t i, ssize_t channel) const
void fill(short v=0, ssize_t channel=EST_ALL)
void f_set(const EST_String name, int val)
INLINE short a_no_check(ssize_t i, ssize_t channel=0) const
EST_read_status load(const EST_String filename, int offset=0, ssize_t length=0, int rate=default_sample_rate)
void set_sample_type(const EST_String t)