my lpc-10 c program works on an ".au" sound file but my aim is to run th
program from a txt file where the sound samples are settled in th
begining part of lines like that :
14183
12593
29486
25712
-9985
12288
16384
-5889
-12033
-22273
-30465
-9985
18432
12288
12288
20480
8192
4096
4096
-12033
................
but i can't solve this problem, the .au file is opened that with that cod
infile = _topen(TEXT("16bit.au"),O_BINARY|O_RDONLY);
and the sample reading part is below.
************************************************** *************
static int readSamples(int f, int type, short *buffer, int len)
{
int count;
if(type == AU_PCM_16_BIT)
{
int i;
/* no conversion needed, just swap */
count = read(f, buffer, sizeof(short) * len);
count /= 2;
swapSamples(buffer, count);
return count;
}
else if(type == AU_PCM_8_BIT)
{
unsigned char temp[1000];
count = read(f, buffer, sizeof(short) * len);
expandSamples(temp, buffer, count);
return count;
}
else
{
unsigned char temp[1000];
/* convert the u-law samples to 16 bit */
count = read(f, temp, len);
ulawDecode(temp, buffer, count);
return count;
}
}
************************************************** ********************
i read the samples with placing that code after read command and i writ
the samples in a txt file which is pointed by f1,
for(i=0;i<len;i++)
fprintf(f1,"%d\n",buffer[i]);
************************************************** ***********
now, how can i read the sound samples from that txt file ????
the original program is i
http://www.hawksoft.com/cgi/philf/cl...ceDI091src.zip