In file ../include/EST_Track.h:

## class EST_Track

> A class for storing time aligned coefficients.

## Inheritance:

### Public Methods

  | Constructor and Destructor functions
  | EST_Track () Default constructor
  | EST_Track (const EST_Track &a) Copy constructor
  | EST_Track (int num_frames, int num_channels) resizing constructor
  | EST_Track (int num_frames, EST_StrList &map) resizing constructor
  | ~EST_Track () default destructor
  | Configuring Tracks
  void | resize (int num_frames, int num_channels, bool preserve = 1) resize the track to have `num_frames` and `num_channels`.
  void | resize (int num_frames, EST_StrList &map, bool preserve = 1) resize the track to have `num_frames` and `num_channels`.
  void | resize_aux (EST_StrList &map, bool preserve = 1) resize the track's auxiliary channels
  void | set_num_channels (int n, bool preserve = 1) Change the number of channels while keeping the number of frames the same.
  void | set_num_frames (int n, bool preserve = 1) Change the number of frames while keeping the number of channels the same.
  void | set_channel_name (const EST_String &name, int channel) set the name of the channel
  void | set_aux_channel_name (const EST_String &name, int channel) set the name of the auxiliary channel
  void | copy_setup (const EST_Track& a) copy everything but data
  | Global track information
  EST_String | name () const name of track - redundant use access to features
  void | set_name (const EST_String &n) set name of track - redundant use access to features
  | Functions for sub tracks, channels and frames.
  void | frame (EST_FVector &fv, int n, int startf=0, int nf=EST_ALL) make `fv` a window to frame `n` in the track.
  void | channel (EST_FVector &cv, int n, int startf=0, int nf=EST_ALL) make `fv` a window to channel `n` in the track.
  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.
  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.
  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.
  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.
  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`.
  void | copy_channel_out (int n, float* buf, int offset=0, int num=EST_ALL) const copy channel `n` into pre-allocated buffer buf
  void | copy_frame_out (int n, float* buf, int offset=0, int num=EST_ALL) const copy frame `n` into pre-allocated buffer buf
  void | copy_frame_out (int n, EST_FVector &f, int offset=0, int num=EST_ALL) const copy frame `n` into EST_FVector
  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
  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
  void | copy_frame_in (int n, const float* buf, int offset=0, int num=EST_ALL) copy buf into frame n of track
  void | copy_frame_in (int n, const EST_FVector &t, int offset=0, int num=EST_ALL) copy t into frame n of track
  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 information
  int | channel_position (const char* name, int offset=0) const Return the position of channel `name` if it exists, otherwise return -1
  int | channel_position (EST_String name, int offset=0) const Return the position of channel `name` if it exists, otherwise return -1
  bool | has_channel (const char* name) const Returns true if the track has a channel named `name`, otherwise false
  bool | has_channel (EST_String name) const Returns true if the track has a channel named `name`, otherwise false
  | Accessing amplitudes The following functions can be used
  float& | a (int i, int c=0) return amplitude of frame i, channel c
  float& | a_no_check (int i, int c=0) return amplitude of frame i, channel c with no bounds checking.
  float& | a (int i, const char* name, int offset=0) return amplitude of point i, in the channel named name plus offset.
  float& | a (float t, int c=0, EST_InterpType interp=it_nearest) return amplitude of time t, channel c.
  float& | operator() (int i, int c) return amplitude of frame i, channel c.
  float& | operator() (int i) return amplitude of frame i, channel 0.
  float& | operator() (float t, int c) return amplitude of frame nearest time t, channel c.
  float& | operator() (float t) return amplitude of frame nearest time t, channel 0.
  | Timing
  float& | t (int i=0) return time position of frame i
  float | ms_t (int i) const return time of framet i in milli-seconds
  void | fill_time (float t, int start =1) set frame times to regular intervals of time `t`
  void | fill_time (EST_Track &t) fill times with times of other track
  void | fill (float v) fill all amplitudes with value `v`
  void | sample (float shift) resample track at this frame shift, specified in seconds.
  void | change_type (float nshift, bool single_break) REDO
  float | shift () const return an estimation of the frame spacing in seconds.
  float | start () const return time of first value in track
  float | end () const return time of last value in track
  | File i/o functions
  EST_read_status | load (const EST_String name, float ishift = 0.0) Load a file called `name` into the track.
  EST_read_status | load (EST_TokenStream &ts, float ishift = 0.0) Load character data from an already opened tokenstream `ts` into the track.
  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.
  EST_write_status | save (const EST_String name, const EST_String EST_filetype = "") Save the track to a file `name` of format `type`.
  EST_write_status | save (FILE* fp, const EST_String EST_filetype = "") Save the track to a already opened file pointer`FP` and write a file of format `type`.
  | Utility functions
  int | empty () const returns true if no values are set in the frame
  void | set_break (int i) set frame i to be a break
  void | set_value (int i) set frame i to be a value
  int | val (int i) const return true if frame i is a value
  int | track_break (int i) const return true if frame i is a break
  int | prev_non_break (int i) const starting at frame i, return the frame index of the first value frame before i.
  int | next_non_break (int i) const starting at frame i, return the frame index of the first value frame after i.
  int | index (float t) const return the frame index nearest time t
  int | index_below (float x) const return the frame index before time t
  int | num_frames () const return number of frames in track
  int | length () const return number of frames in track
  int | num_channels () const return number of channels in track
  int | num_aux_channels () const return number of auxiliary channels in track
  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.
  bool | equal_space () const return true if track has equal (ie.
  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.

`Constructor and Destructor functions`

`EST_Track()`
  Default constructor

`EST_Track(const EST_Track &a)`
  Copy constructor

`EST_Track(int num_frames, int num_channels)`
  resizing constructor

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

`~EST_Track()`
  default destructor

`Configuring Tracks`

`void 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

`void 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

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

`void 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

`void 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

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

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

`void copy_setup(const EST_Track& a)`
  copy everything but data

`Global track information`

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

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

`Functions for sub tracks, channels and frames.`

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

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

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

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

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

`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. (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

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

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

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

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

`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

`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

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

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

`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 information`

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

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

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

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

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

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

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

  `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);

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

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

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

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

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

`Timing`

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

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

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

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

`void fill(float v)`
  fill all amplitudes with value `v`

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

`void change_type(float nshift, bool single_break)`
  REDO

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

`float start() const`
  return time of first value in track

`float end() const`
  return time of last value in track

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

`File i/o functions`

`EST_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

`EST_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

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

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

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

`Utility functions`

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

`void set_break(int i)`
  set frame i to be a break

`void set_value(int i)`
  set frame i to be a value

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

`int track_break(int i) const`
  return true if frame i is a 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

`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

`int index(float t) const`
  return the frame index nearest time t

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

`int num_frames() const`
  return number of frames in track

`int length() const`
  return number of frames in track

`int num_channels() const`
  return number of channels in track

`int num_aux_channels() const`
  return number of auxiliary channels in track

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

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

`bool 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