ADCREAD(3SP)

NAME
AdcRead, AdcWrite - read and write ADC files

SYNOPSIS

#include <speech.h>
#include <ad.h>

int AdcRead (char *filename, short **Speech, int *Sample_Rate)

int AdcWrite (char *filename, short *Speech, int NumSamples,
              int Sample_Rate)

DESCRIPTION

AdcRead() reads the ADC file denoted by filename into memory. The sampled signal points are placed in space allocated using malloc(3). The address of the memory allocated is returned using the pointer Speech. Sample_Rate denotes the sampling frequency in Hz.

AdcWrite() creates an ADC file denoted by filename containing the sampled data pointed to by Speech. The variable NumSamples denotes the size of the data array. The sampling frequency is set to Sample_Rate. AdcWrite() creates the file without read permission. When the write completes the file permission is set to 0644 (Both Read and Write Permission).

DIAGNOSTICS

AdcRead() returns the number of sample points read or a negative number on error and sets ErrorString.

AdcWrite() returns a negative number on error and sets ErrorString.

EXAMPLES

number_of_samples = AdcRead ("test.adc", &signal, &rate);

success = AdcWrite("output.adc", signal, 20000, 8000);

SEE ALSO
ErrorString(3SP), malloc(3), free(3), chmod(2)

BUGS

AUTHORS
Based on code written by Fil Alleva at Carnegie-Mellon University.