int main( )
{
short int * speech_samples; /* Array of speechsamples */
INT32 file_length;/* Number of samples in speech file */
INT32 num_read; /*number of elements read from file */
charpSpeechFilename[100];
char *argv[]={"dg105.wav"};
FILE *speech_file;
intPartitionNumber;
FLOAT PredictedMos;
strcpy(pSpeechFilename,argv[0]);
/* open speech file*/
if((speech_file =fopen(pSpeechFilename, "rb")) == NULL )
{
printf("Cannot open file %s\n", pSpeechFilename ) ;
exit(-1) ;
}
/* Read speechsamples from file */
fseek(speech_file,0 , SEEK_END) ;
file_length =(ftell(speech_file))/(sizeof(short int)) ;
fseek(speech_file,0 , SEEK_SET) ;
speech_samples =(short int *)calloc(file_length, sizeof(short int)) ;
num_read =fread(speech_samples, sizeof(short int), file_length, speech_file);
printf("num_read=%d",num_read);
return 0;
}
|