# Functions

## Auxiliary Track Functions

### EST_track_aux.h

EST_Track Auxiliary functions

#### abs_error()

 float abs_error ( EST_Track &a, EST_Track &b, int channel)

Calculate the mean absolute error between the same channel in two tracks. This is given by #### differentiate()

 EST_Track differentiate ( EST_Track &c, float samp_int=0.0)

Calculate the simple derivative of a track. This is given by The values in the resultant track are spaced midway between the values in the input track, resulting in 1 fewer frames in the track. This is a very local estimation of the derivative of the track at a point in time. A smoother value can be obtained using the delta function.

#### rms_error()

 float rms_error ( EST_Track &a, EST_Track &b, int channel)

Calculate the root mean square error between the same channel in two tracks. The channel is identified by its index.

#### rms_error()

 EST_FVector rms_error ( EST_Track &a, EST_Track &b)

Calculate the root mean square error between each channels in two tracks. For two tracks of M channels, the result is returned as an EST_FVector of size M, with element {\it i} representing the rms error for channel {\it i}.

#### align_to_track()

 void align_to_track ( EST_Track &tr, float &start, float &end)

Move the start and end variables to the nearest frame.

#### align_to_track()

 void align_to_track ( EST_Track &tr, int &start, int &end, int sample_rate)

Move the start and end variables to the nearest frame.

#### move_to_frame_ends()

 void move_to_frame_ends ( EST_Track &tr, int &start, int &end, int sample_rate, float offset=0.0)

Move the start and end variables to the start and end of the nearest frame.

#### nearest_boundary()

 int nearest_boundary ( EST_Track &tr, float time, int sample_rate, float offset=0)

Index of the frame whose start boundary

#### set_start()

 void set_start ( EST_Track &tr, float start)

Move the track so that it starts at the indicated time.

#### move_start()

 void move_start ( EST_Track &tr, float shift)

Move the track by {\it shift} seconds

#### get_time_frame_size()

 float get_time_frame_size ( EST_Track &pms, int i, int prefer_prev = 0)

Return the frame size in {\bf seconds} based on analysis of current time points. This function basically determines the local frame size (shift) by subtracting the current time point from the next time point. If the {\tt prefer_prev} flag is set to {\tt true}, or the index is the last in the track, the size is determined by subtracting the previous time point from the current one.

This is most commonly used in pitch synchronous analysis to determine the local pitch period.

#### get_frame_size()

 int get_frame_size ( EST_Track &pms, int current_pos, int sample_rate, int prefer_prev=0)

Return the frame size in {\bf samples} based on analysis of current time points. This function basically determines the local frame size (shift) by subtracting the current time point from the next time point. If the {\tt prefer_prev} flag is set to {\tt true}, or the index is the last in the track, the size is determined by subtracting the previous time point from the current one.

This is most commonly used in pitch synchronous analysis to determine the local pitch period.

#### get_order()

 int get_order ( const EST_Track &t, EST_CoefficientType type, int d=0)

How many coefficiants in track (looks for Coef0 and coefN channels)

#### sum_lengths()

 int sum_lengths ( const EST_Track &t, int sample_rate, int start_frame=0, int end_frame=-1)

Total the length channel values.

#### get_start_positions()

 void get_start_positions ( const EST_Track &t, int sample_rate, EST_TBuffer &pos)

Find the start point in the signal of the sections of speech related to each frame.

#### Analysis frame position

Functions which define which part of a single is associated with a given frame in a track.

This is defined here in one place for consistancy. They are inline since they tiend to be used in inner loops.There are two versions, the second for when there are offsets in the track.

##### get_frame()
 static inline void get_frame ( const EST_Track &tr, int sample_rate, int f, int &start, int ¢er, int &end)

Get the start and end of a given frame (in samples)

##### get_frame()
 static inline void get_frame ( const EST_Track &tr, int sample_rate, int f, float &start, float ¢er, float &end)

Get the start and end of a given frame (in seconds)

##### get_frame_o()
 static inline void get_frame_o ( const EST_Track &tr, int sample_rate, int f, int &start, int ¢er, int &end)

Get the start and end of a given frame (in samples)

##### get_frame_o()
 static inline void get_frame_o ( const EST_Track &tr, int sample_rate, int f, float &start, float ¢er, float &end)

Get the start and end of a given frame (in seconds)