aud.c
资源名称:export.zip [点击查看]
上传用户:hepax88
上传日期:2007-01-03
资源大小:1101k
文件大小:0k
源码类别:
TCP/IP协议栈
开发平台:
Visual C++
- #include <stdio.h>
- #include <math.h>
- #define DMASIZE 16384
- main()
- {
- unsigned char buf[DMASIZE];
- double x,y;
- unsigned samp;
- int i;
- FILE *fp;
- fp = fopen("test.aud","wb");
- for(i=0;i<4096;i++){
- x = 2*3.141592653589*(i*256.)/4096.;
- samp = 32767 * cos(x);
- buf[4*i] = samp;
- buf[4*i+1] = samp >> 8;
- x = 2*3.141592653589*(i*192.)/4096.;
- samp = 32767 * cos(x);
- buf[4*i+2] = samp;
- buf[4*i+3] = samp >> 8;
- }
- fwrite(buf,1,DMASIZE,fp);
- fclose(fp);
- }