class | EST_Wave | ( | : public EST_Featured |
A class for storing digital waveforms. The waveform is stored as an arraay of 16 bit shorts. Mutliple channels are supported, but if no channel information is given the 0th channel is accessed.
The waveforms can be of any sample rate, and can be changed to another samping rate using the resample function.
a()
short& a ( int i, int channel = 0) return amplitude of sample i from channel channel. By default the 0th channel is selected. This function can be used for assignment.
operator)()
short operator) ( int i, int channel) const return amplitude of sample i from channel channel. By default the 0th channel is selected.
a_safe()
short& a_safe ( int i, int channel = 0) Version of a() that returns zero if index is out of array bounds. This is particularly useful in signal processing when you want to have windows going off the end of the waveform.
sample_type()
EST_String sample_type ( ) const returns the file format of the file from which the waveform was read. If the waveform has not been read from a file, this is set to the default type
name()
EST_String name ( ) const A string indentifying the waveform, commonly used to store the filename
rescale()
void rescale ( float gain, int normalize=0) multiply all samples by a factor gain. This checks for overflows and puts them to the maximum positive or negative value as appropriate.
load()
EST_read_status load ( const EST_String filename, int offset=0, int length = 0, int rate = default_sample_rate) Load a file into the waveform. The load routine attempts to automatically determine which file type is being loaded. A portion of the waveform can be loaded by setting offset to the sample position from the beginning and to the number of required samples after this.
load_file()
EST_read_status load_file ( const EST_String filename, const EST_String filetype, int sample_rate, const EST_String sample_type, int bo, int nc, int offset = 0, int length = 0) Load a file of type filetype into the waveform. This can be used to load unheadered files, in which case the fields sample_rate, sample_type, bo and nc are used to specify the sample rate, type, byte order and number of channels. A portion of the waveform can be loaded by setting offset to the sample position from the beginning and to the number of required samples after this.
save()
EST_write_status save ( const EST_String filename, const EST_String EST_filetype = "") Save waveform to a file called filename of file format EST_filetype
save()
EST_write_status save ( FILE *fp, const EST_String EST_filetype = "") Save waveform to a already openend file with file pointer *FP
operator +=()
EST_Wave& operator += ( const EST_Wave &a) Add to existing wave in serial. Waveforms must have the same number of channels.
operator |=()
EST_Wave& operator |= ( const EST_Wave &a) Add wave in parallel, i.e. make wave a become new channels in existing waveform.
class | EST_Track | ( | : public EST_Featured |
A class for storing time aligned coefficients.
some stuff.
resize()
void resize ( int num_frames, int num_channels, bool preserve = 1) resize the track to have {\tt num_frames} and {\tt num_channels}. if {\tt preserve} is set to 1, any existing values in the track are kept, up to the limits imposed by the new number of frames and channels. If the new track size is bigger, new positions are filled with 0
resize()
void resize ( int num_frames, EST_StrList &map, bool preserve = 1) resize the track to have {\tt num_frames} and {\tt num_channels}. if {\tt preserve} is set to 1, any existing values in the track are kept, up to the limits imposed by the new number of frames and channels. If the new track size is bigger, new positions are filled with 0
resize_aux()
void resize_aux ( EST_StrList &map, bool preserve = 1) resize the track's auxiliary channels
set_num_channels()
void set_num_channels ( int n, bool preserve = 1) Change the number of channels while keeping the number of frames the same. if {\tt preserve} is set to 1, any existing values in the track are kept, up to the limits imposed by the new number of frames and channels. If the new track size is bigger, new positions are filled with 0
set_num_frames()
void set_num_frames ( int n, bool preserve = 1) Change the number of frames while keeping the number of channels the same. if {\tt preserve} is set to 1, any existing values in the track are kept, up to the limits imposed by the new number of frames and channels. If the new track size is bigger, new positions are filled with 0
set_channel_name()
void set_channel_name ( const EST_String &name, int channel) set the name of the channel.
set_aux_channel_name()
void set_aux_channel_name ( const EST_String &name, int channel) set the name of the auxiliary channel.
frame()
void frame ( EST_FVector &fv, int n, int startf=0, int nf=EST_ALL) make {\tt fv} a window to frame {\tt n} in the track
channel()
void channel ( EST_FVector &cv, int n, int startf=0, int nf=EST_ALL) make {\tt fv} a window to channel {\tt n} in the track
channel()
void channel ( EST_FVector &cv, const char * name, int startf=0, int nf=EST_ALL) make {\tt fv} a window to the named channel in the track
sub_track()
void sub_track ( EST_Track &st, int start_frame=0, int nframes=EST_ALL, int start_chan=0, int nchans=EST_ALL) make {\tt st} refer to a portion of the track. No values are copied - an internal pointer in st is set to the specified portion of the the track. After this, st behaves like a normal track. Its first channel is the same as start_channel and its first frame is the same as start_frame. Any values written into st will changes values in the main track. st cannot be resized.
Parameters start_frame first frame at which sub-track starts
nframes number of frames to be included in total
start_channel first channel at which sub-track starts
nframes number of channels to be included in total
sub_track()
void sub_track ( EST_Track &st, int start_frame, int nframes, const EST_String &start_chan_name, int nchans=EST_ALL) make {\tt st} refer to a portion of the track. No values are copied - an internal pointer in st is set to the specified portion of the the track. After this, st behaves like a normal track. Its first channel is the same as start_channel and its first frame is the same as start_frame. Any values written into st will changes values in the main track. st cannot be resized.
Parameters start_frame first frame at which sub-track starts
nframes number of frames to be included in total
start_channel_name name of channel at which sub-track starts
end_channel_name name of channel at which sub-track stops
sub_track()
void sub_track ( EST_Track &st, int start_frame, int nframes, const EST_String &start_chan_name, const EST_String &end_chan_name) make {\tt st} refer to a portion of the track. No values are copied - an internal pointer in st is set to the specified portion of the the track. After this, st behaves like a normal track. Its first channel is the same as start_channel and its first frame is the same as start_frame. Any values written into st will changes values in the main track. st cannot be resized.
Parameters start_frame first frame at which sub-track starts
nframes number of frames to be included in total
start_channel_name name of channel at which sub-track starts
end_channel_name name of channel at which sub-track stops
sub_track()
void sub_track ( EST_Track &st, int start_frame=0, int nframes=EST_ALL, int start_chan=0, int nchans=EST_ALL) const make {\tt st} refer to a portion of the track. (const version) No values are copied - an internal pointer in st is set to the specified portion of the the track. After this, st behaves like a normal track. Its first channel is the same as start_channel and its first frame is the same as start_frame. Any values written into st will changes values in the main track. st cannot be resized.
Parameters start_frame first frame at which sub-track starts
nframes number of frames to be included in total
start_channel first channel at which sub-track starts
nframes number of channels to be included in total
copy_sub_track()
void copy_sub_track ( EST_Track &st, int start_frame=0, int nframes=EST_ALL, int start_chan=0, int nchans=EST_ALL) const Copy contiguous portion of track into {\tt st}. Unilike the normal sub_track functions, this makes a completely new track. values written into this will not affect the main track and it can be resized.
Parameters start_frame first frame at which sub-track starts
nframes number of frames to be included in total
start_channel first channel at which sub-track starts
nframes number of channels to be included in total
copy_channel_out()
void copy_channel_out ( int n, float *buf, int offset=0, int num=EST_ALL) const copy channel {\tt n} into pre-allocated buffer buf
copy_frame_out()
void copy_frame_out ( int n, float *buf, int offset=0, int num=EST_ALL) const copy frame {\tt n} into pre-allocated buffer buf
copy_channel_in()
void copy_channel_in ( int n, const float *buf, int offset=0, int num=EST_ALL) copy buf into pre-allocated channel n of track
copy_channel_in()
void copy_channel_in ( int c, const EST_Track &from, int from_c, int from_offset=0, int offset=0, int num=EST_ALL) copy channel buf into pre-allocated channel n of track
copy_frame_in()
void copy_frame_in ( int n, const float *buf, int offset=0, int num=EST_ALL) copy buf into frame n of track
copy_frame_in()
void copy_frame_in ( int n, const EST_FVector &t, int offset=0, int num=EST_ALL) copy t into frame n of track
copy_frame_in()
void copy_frame_in ( int i, const EST_Track &from, int from_f, int from_offset=0, int offset=0, int num=EST_ALL) copy from into frame n of track
channel_position()
int channel_position ( const char *name, int offset=0) const Return the position of channel {\tt name} if it exists, otherwise return -1
channel_position()
int channel_position ( EST_String name, int offset=0) const Return the position of channel {\tt name} if it exists, otherwise return -1
has_channel()
bool has_channel ( const char *name) const Returns true if the track has a channel named {\tt name}, otherwise false
has_channel()
bool has_channel ( EST_String name) const Returns true if the track has a channel named {\tt name}, otherwise false
to access to amplitude of the track at certain points. Most of these functions can be used for reading or writing to this point, thus
tr.a(10, 5) = 10.3;
can be used to set the 10th frame of the 5th channel and
cout << tr.a(10, 5);
can be used to print the same information. Most of these functions have a const equivalent for helping the compiler in read only operations.
a_no_check()
float& a_no_check ( int i, int c=0) return amplitude of frame i, channel c with no bounds checking
a()
float& a ( int i, const char *name, int offset=0) return amplitude of point i, in the channel named name plus offset. If you have a track with say channels called F0 and voicing, you can access the 45th frame's F0 as t.a(45, "F0"); If there are 20 cepstral coefficients for each frame, the 5th can be accessed as t.a(45, "cepstrum", 5);
a()
float& a ( float t, int c=0, EST_InterpType interp=it_nearest) return amplitude of time t, channel c. This can be used for reading or writing to this point. By default the nearest frame to this time is used. If {\tt interp} is set to {\tt it_linear}, linear interpolaion is performed between the two amplitudes of the two frames either side of the time point to give an estimation of what the amplitude would have been at time {\tt t}. If {\tt interp} is set to {\tt it_linear_nz}, interpolation is as above, unless the time requested is off the end of a portion of track in which case the nearest amplitude is returned.
fill_time()
void fill_time ( float t, int start =1) set frame times to regular intervals of time {\tt t}
sample()
void sample ( float shift) resample track at this frame shift, specified in seconds. This can be used to change a variable frame spaced track into a fixed frame track, or to change the spacing of an existing evenly spaced track.
shift()
float shift ( ) const return an estimation of the frame spacing in seconds. This returns -1 if the track is not a fixed shift track
Auxiliary information is used to store information that goes along with frames, but which are not amplitudes and hence not appropriate for operations such as interpolation, smoothing etc. The aux() array is an array of EST_Vals which allows points to be int, float or a string.
The following functions can be used to access to auxiliary track information. Most of these functions can be used for reading or writing to this point, thus
tr.aux(10, "voicing") = 1;
can be used to set the 10th frame of the "voicing" channel and
cout << tr.a(10, "voicing");
can be used to print the same information. Most of these functions have a const equivalent for helping the compiler in read only operations.
Auxiliary channels are usually accessed by name rather than numerical index. The names are set using the set_aux_channel_names() function.
load()
EST_read_status load ( const EST_String name, float ishift = 0.0) Load a file called {\tt name} into the track. The load function attempts to automatically determine which file type is being loaded from the file's header. If no header is found, the function assumes the file is ascii data, with a fixed frame shift, arranged with rows representing frames and columns channels. In this case, the frame shift must be specified as an argument to this function
load()
EST_read_status load ( EST_TokenStream &ts, float ishift = 0.0) Load character data from an already opened tokenstream {\tt ts} into the track. The load function attempts to automatically determine which file type is being loaded from the file's header. If no header is found, the function assumes the file is ascii data, with a fixed frame shift, arranged with rows representing frames and columns channels. In this case, the frame shift must be specified as an argument to this function
load()
EST_read_status load ( const EST_String name, const EST_String type, float ishift = 0.0) Load a file called {\tt name} of format {\tt type} into the track. If no header is found, the function assumes the file is ascii data, with a fixed frame shift, arranged with rows representing frames and columns channels. In this case, the frame shift must be specified as an argument to this function
save()
EST_write_status save ( const EST_String name, const EST_String EST_filetype = "") Save the track to a file {\tt name} of format {\tt type}
save()
EST_write_status save ( FILE *fp, const EST_String EST_filetype = "") Save the track to a already opened file pointer{\tt FP} and write a file of format {\tt type}
prev_non_break()
int prev_non_break ( int i) const starting at frame i, return the frame index of the first value frame before i. If frame i is a value, return i
next_non_break()
int next_non_break ( int i) const starting at frame i, return the frame index of the first value frame after i. If frame i is a value, return i
rm_excess_breaks()
void rm_excess_breaks ( ) If the contour has multiple break values between sections containing values, reduce the break sections so that each has a single break only
single_break()
bool single_break ( ) const return true if track has only single breaks between value sections