In file ../include/EST_Track.h:

class EST_Track

A class for storing time aligned coefficients.

Inheritance:


Public Methods

[more] Constructor and Destructor functions

[more] EST_Track ()
Default constructor
[more] EST_Track (const EST_Track &a)
Copy constructor
[more] EST_Track (int num_frames, int num_channels)
resizing constructor
[more] EST_Track (int num_frames, EST_StrList &map)
resizing constructor
[more] ~EST_Track ()
default destructor

[more] Configuring Tracks

[more]void resize (int num_frames, int num_channels, bool preserve = 1)
resize the track to have num_frames and num_channels.
[more]void resize (int num_frames, EST_StrList &map, bool preserve = 1)
resize the track to have num_frames and num_channels.
[more]void resize_aux (EST_StrList &map, bool preserve = 1)
resize the track's auxiliary channels
[more]void set_num_channels (int n, bool preserve = 1)
Change the number of channels while keeping the number of frames the same.
[more]void set_num_frames (int n, bool preserve = 1)
Change the number of frames while keeping the number of channels the same.
[more]void set_channel_name (const EST_String &name, int channel)
set the name of the channel
[more]void set_aux_channel_name (const EST_String &name, int channel)
set the name of the auxiliary channel
[more]void copy_setup (const EST_Track& a)
copy everything but data

[more] Global track information

[more]EST_String name () const
name of track - redundant use access to features
[more]void set_name (const EST_String &n)
set name of track - redundant use access to features

[more] Functions for sub tracks, channels and frames.

[more]void frame (EST_FVector &fv, int n, int startf=0, int nf=EST_ALL)
make fv a window to frame n in the track.
[more]void channel (EST_FVector &cv, int n, int startf=0, int nf=EST_ALL)
make fv a window to channel n in the track.
[more]void channel (EST_FVector &cv, const char* name, int startf=0, int nf=EST_ALL)
make fv a window to the named channel in the track.
[more]void sub_track (EST_Track &st, int start_frame, int nframes, const EST_String &start_chan_name, int nchans=EST_ALL)
make st refer to a portion of the track.
[more]void sub_track (EST_Track &st, int start_frame, int nframes, const EST_String &start_chan_name, const EST_String &end_chan_name)
make st refer to a portion of the track.
[more]void sub_track (EST_Track &st, int start_frame=0, int nframes=EST_ALL, int start_chan=0, int nchans=EST_ALL) const
make st refer to a portion of the track.make st refer to a portion of the track.
[more]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 st.
[more]void copy_channel_out (int n, float* buf, int offset=0, int num=EST_ALL) const
copy channel n into pre-allocated buffer buf
[more]void copy_frame_out (int n, float* buf, int offset=0, int num=EST_ALL) const
copy frame n into pre-allocated buffer buf
[more]void copy_frame_out (int n, EST_FVector &f, int offset=0, int num=EST_ALL) const
copy frame n into EST_FVector
[more]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
[more]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
[more]void copy_frame_in (int n, const float* buf, int offset=0, int num=EST_ALL)
copy buf into frame n of track
[more]void copy_frame_in (int n, const EST_FVector &t, int offset=0, int num=EST_ALL)
copy t into frame n of track
[more]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

[more] Channel information

[more]int channel_position (const char* name, int offset=0) const
Return the position of channel name if it exists, otherwise return -1
[more]int channel_position (EST_String name, int offset=0) const
Return the position of channel name if it exists, otherwise return -1
[more]bool has_channel (const char* name) const
Returns true if the track has a channel named name, otherwise false
[more]bool has_channel (EST_String name) const
Returns true if the track has a channel named name, otherwise false

[more] Accessing amplitudes The following functions can be used

[more]float& a (int i, int c=0)
return amplitude of frame i, channel c
[more]float& a_no_check (int i, int c=0)
return amplitude of frame i, channel c with no bounds checking.
[more]float& a (int i, const char* name, int offset=0)
return amplitude of point i, in the channel named name plus offset.
[more]float& a (float t, int c=0, EST_InterpType interp=it_nearest)
return amplitude of time t, channel c.
[more]float& operator() (int i, int c)
return amplitude of frame i, channel c.
[more]float& operator() (int i)
return amplitude of frame i, channel 0.
[more]float& operator() (float t, int c)
return amplitude of frame nearest time t, channel c.
[more]float& operator() (float t)
return amplitude of frame nearest time t, channel 0.

[more] Timing

[more]float& t (int i=0)
return time position of frame i
[more]float ms_t (int i) const
return time of framet i in milli-seconds
[more]void fill_time (float t, int start =1)
set frame times to regular intervals of time t
[more]void fill_time (EST_Track &t)
fill times with times of other track
[more]void fill (float v)
fill all amplitudes with value v
[more]void sample (float shift)
resample track at this frame shift, specified in seconds.
[more]void change_type (float nshift, bool single_break)
REDO
[more]float shift () const
return an estimation of the frame spacing in seconds.
[more]float start () const
return time of first value in track
[more]float end () const
return time of last value in track

[more] File i/o functions

[more]EST_read_status load (const EST_String name, float ishift = 0.0)
Load a file called name into the track.
[more]EST_read_status load (EST_TokenStream &ts, float ishift = 0.0)
Load character data from an already opened tokenstream ts into the track.
[more]EST_read_status load (const EST_String name, const EST_String type, float ishift = 0.0)
Load a file called name of format type into the track.
[more]EST_write_status save (const EST_String name, const EST_String EST_filetype = "")
Save the track to a file name of format type.
[more]EST_write_status save (FILE* fp, const EST_String EST_filetype = "")
Save the track to a already opened file pointerFP and write a file of format type.

[more] Utility functions

[more]int empty () const
returns true if no values are set in the frame
[more]void set_break (int i)
set frame i to be a break
[more]void set_value (int i)
set frame i to be a value
[more]int val (int i) const
return true if frame i is a value
[more]int track_break (int i) const
return true if frame i is a break
[more]int prev_non_break (int i) const
starting at frame i, return the frame index of the first value frame before i.
[more]int next_non_break (int i) const
starting at frame i, return the frame index of the first value frame after i.
[more]int index (float t) const
return the frame index nearest time t
[more]int index_below (float x) const
return the frame index before time t
[more]int num_frames () const
return number of frames in track
[more]int length () const
return number of frames in track
[more]int num_channels () const
return number of channels in track
[more]int num_aux_channels () const
return number of auxiliary channels in track
[more]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.
[more]bool equal_space () const
return true if track has equal (ie.
[more]bool single_break () const
return true if track has only single breaks between value sections


Inherited from EST_Featured:


Documentation

A class for storing time aligned coefficients.

some stuff.

o Constructor and Destructor functions

o EST_Track()
Default constructor

o EST_Track(const EST_Track &a)
Copy constructor

o EST_Track(int num_frames, int num_channels)
resizing constructor

o EST_Track(int num_frames, EST_StrList &map)
resizing constructor

o ~EST_Track()
default destructor

o Configuring Tracks

ovoid resize(int num_frames, int num_channels, bool preserve = 1)
resize the track to have num_frames and num_channels. if 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

ovoid resize(int num_frames, EST_StrList &map, bool preserve = 1)
resize the track to have num_frames and num_channels. if 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

ovoid resize_aux(EST_StrList &map, bool preserve = 1)
resize the track's auxiliary channels

ovoid set_num_channels(int n, bool preserve = 1)
Change the number of channels while keeping the number of frames the same. if 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

ovoid set_num_frames(int n, bool preserve = 1)
Change the number of frames while keeping the number of channels the same. if 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

ovoid set_channel_name(const EST_String &name, int channel)
set the name of the channel

ovoid set_aux_channel_name(const EST_String &name, int channel)
set the name of the auxiliary channel

ovoid copy_setup(const EST_Track& a)
copy everything but data

o Global track information

oEST_String name() const
name of track - redundant use access to features

ovoid set_name(const EST_String &n)
set name of track - redundant use access to features

o Functions for sub tracks, channels and frames.

ovoid frame(EST_FVector &fv, int n, int startf=0, int nf=EST_ALL)
make fv a window to frame n in the track.

ovoid channel(EST_FVector &cv, int n, int startf=0, int nf=EST_ALL)
make fv a window to channel n in the track.

ovoid channel(EST_FVector &cv, const char* name, int startf=0, int nf=EST_ALL)
make fv a window to the named channel in the track.

ovoid sub_track(EST_Track &st, int start_frame, int nframes, const EST_String &start_chan_name, int nchans=EST_ALL)
make 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

ovoid sub_track(EST_Track &st, int start_frame, int nframes, const EST_String &start_chan_name, const EST_String &end_chan_name)
make 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

ovoid sub_track(EST_Track &st, int start_frame=0, int nframes=EST_ALL, int start_chan=0, int nchans=EST_ALL) const
make 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.

make 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
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

ovoid 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 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

ovoid copy_channel_out(int n, float* buf, int offset=0, int num=EST_ALL) const
copy channel n into pre-allocated buffer buf

ovoid copy_frame_out(int n, float* buf, int offset=0, int num=EST_ALL) const
copy frame n into pre-allocated buffer buf

ovoid copy_frame_out(int n, EST_FVector &f, int offset=0, int num=EST_ALL) const
copy frame n into EST_FVector

ovoid copy_channel_in(int n, const float* buf, int offset=0, int num=EST_ALL)
copy buf into pre-allocated channel n of track

ovoid 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

ovoid copy_frame_in(int n, const float* buf, int offset=0, int num=EST_ALL)
copy buf into frame n of track

ovoid copy_frame_in(int n, const EST_FVector &t, int offset=0, int num=EST_ALL)
copy t into frame n of track

ovoid 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

o Channel information

oint channel_position(const char* name, int offset=0) const
Return the position of channel name if it exists, otherwise return -1

oint channel_position(EST_String name, int offset=0) const
Return the position of channel name if it exists, otherwise return -1

obool has_channel(const char* name) const
Returns true if the track has a channel named name, otherwise false

obool has_channel(EST_String name) const
Returns true if the track has a channel named name, otherwise false

o Accessing amplitudes The following functions can be used
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.

ofloat& a(int i, int c=0)
return amplitude of frame i, channel c

ofloat& a_no_check(int i, int c=0)
return amplitude of frame i, channel c with no bounds checking.

ofloat& 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);

ofloat& 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 interp is set to 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 t. If interp is set to 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.

ofloat& operator() (int i, int c)
return amplitude of frame i, channel c.

ofloat& operator() (int i)
return amplitude of frame i, channel 0.

ofloat& operator() (float t, int c)
return amplitude of frame nearest time t, channel c.

ofloat& operator() (float t)
return amplitude of frame nearest time t, channel 0.

o Timing

ofloat& t(int i=0)
return time position of frame i

ofloat ms_t(int i) const
return time of framet i in milli-seconds

ovoid fill_time(float t, int start =1)
set frame times to regular intervals of time t

ovoid fill_time(EST_Track &t)
fill times with times of other track

ovoid fill(float v)
fill all amplitudes with value v

ovoid 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.

ovoid change_type(float nshift, bool single_break)
REDO

ofloat shift() const
return an estimation of the frame spacing in seconds. This returns -1 if the track is not a fixed shift track

ofloat start() const
return time of first value in track

ofloat end() const
return time of last value in track

o Auxiliary channels
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.

o File i/o functions

oEST_read_status load(const EST_String name, float ishift = 0.0)
Load a file called 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

oEST_read_status load(EST_TokenStream &ts, float ishift = 0.0)
Load character data from an already opened tokenstream 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

oEST_read_status load(const EST_String name, const EST_String type, float ishift = 0.0)
Load a file called name of format 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

oEST_write_status save(const EST_String name, const EST_String EST_filetype = "")
Save the track to a file name of format type.

oEST_write_status save(FILE* fp, const EST_String EST_filetype = "")
Save the track to a already opened file pointerFP and write a file of format type.

o Utility functions

oint empty() const
returns true if no values are set in the frame

ovoid set_break(int i)
set frame i to be a break

ovoid set_value(int i)
set frame i to be a value

oint val(int i) const
return true if frame i is a value

oint track_break(int i) const
return true if frame i is a break

oint 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

oint 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

oint index(float t) const
return the frame index nearest time t

oint index_below(float x) const
return the frame index before time t

oint num_frames() const
return number of frames in track

oint length() const
return number of frames in track

oint num_channels() const
return number of channels in track

oint num_aux_channels() const
return number of auxiliary channels in track

ovoid 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.

obool equal_space() const
return true if track has equal (ie. fixed) frame spacing */

obool single_break() const
return true if track has only single breaks between value sections


This class has no child classes.
Friends:
ostream& operator << (ostream& s, const EST_Track &tr)
class EST_TIterator< EST_Track, IPointer_f, EST_Track >
class EST_TRwIterator< EST_Track, IPointer_f, EST_Track >

Alphabetic index HTML hierarchy of classes or Java


This page is part of the Edinburgh Speech Tools Library documentation
Copyright University of Edinburgh 1997
Contact: speech_tools@cstr.ed.ac.uk