read_25

Digital Signal Processing Library

Voice Lab

Program name: read_25

Language: C

In file: file_lib.c

Objective: Read data from file. If sample rate is 50K, throw out the even samples, leaving an efective 25K sample rate.

Usage: int read_25(FILE *in_file, int data_size, int sample_rate, int *result);

Parameters:

  • in_file - FILE Pointer to open file to process.
  • data_size - Length of data word - typically 2 bytes.
  • sample_rate - number of bits per sample - typically 16.
  • result - data read
Return:
  • count - should be equal to data_size, typically 2

Mathematical Description:

Comments: Routine is used to read data file and return a value. If sample rate is 50K, downsample to 25K

User Comments

Code:

int read_25(FILE *in_file, int data_size, int sample_rate, int *result)
{
        int i, count;

        count = read_data(in_file, data_size, sample_rate, result);
        if(sample_rate == 50000) {
                /* Throw out the even data, reducing the data rate to 25000 */
                read_data(in_file, data_size, sample_rate, &i);
        }
        return(count);
}