Re: share your best software experience
best software ever let you haer ultrasonic voices(frequncies)
include ‘stdio.h’
include 'unistd.h.
include ‘errno.h’
include ‘sys/soundcard.h’
include ‘sys/ioctl.h’
include ‘fcntl.h’
define ABUFSIZE 4096
FILE *fd;
char *outname = “sound.au”;
//char afile “/dev/dsp”;
int afd,sndfmt,channels,speed,i,rc,data,t,b;
unsigned char abuf[ABUFSIZE];
int n=ABUFSIZE;
int speed =11025;
//b = abuf;
main(){
if ((afd = open(“/dev/dsp”,O_RDWR,0 )) == -1)
{
perror(“/dev/dsp”);
exit(errno);
}
else printf("afd=openfile %d
",afd);
//-------------------------------------------------------------------------
if (ioctl(afd, SNDCTL_DSP_SETFMT, &sndfmt) == -1)
{
perror(“mu law”);
exit(errno);
}
else printf("sndfmt %d
", sndfmt);
//------------------------------------------------------------------------
if (ioctl(afd, SNDCTL_DSP_CHANNELS, &channels) == -1)
{
perror(“mono”);
exit(errno);
}
else printf("channels %d
", channels);
//------------------------------------------------------------------------
if (ioctl(afd, SNDCTL_DSP_SPEED, &speed) == -1)
{
perror(“8000 sps”);
exit(errno);
}
printf("speed %d
", speed);
//------------create------------------------------------------------------
/* if ((fd=open(outname,“O_RDONLY”)) ==-1){
printf("panga 2
“);
}
/
//------------------------------------------------------------------------
while(1)
{ if ((rc = read(afd, abuf, ABUFSIZE)) == -1)
{
perror(“audio write”);
exit(errno); }
for(i=0;i<ABUFSIZE;i++){
b= abuf-128;
printf(”%d
",b);
}
write(afd, abuf, ABUFSIZE);
}
}
<stdio.h><unistd.h><errno.h><fcntl.h><abufsize ;i=“”>
:desimunda:</fcntl.h></errno.h></unistd.h></stdio.h>