第一段:
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
void make_sin(unsigned long nSamplesPerSec, unsigned short SamplesTime, char *ad_file)
{FILE *fp=fopen(ad_file,"wt");
unsigned long dataNo=nSamplesPerSec*SamplesTime; //数据个数=采样率*采样时间
float *data;
int i;
if(fp==NULL)
printf("open file failed!\n");
data=(float*)malloc(nSamplesPerSec*SamplesTime*4);//unsigned long是四个字节
for(i=0; i<dataNo; i++)
{data[i]=sin((float)(i)/nSamplesPerSec);
fprintf(fp,"%f\n",data[i]);}}
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
void make_sin(unsigned long nSamplesPerSec, unsigned short SamplesTime, char *ad_file)
{FILE *fp=fopen(ad_file,"wt");
unsigned long dataNo=nSamplesPerSec*SamplesTime; //数据个数=采样率*采样时间
float *data;
int i;
if(fp==NULL)
printf("open file failed!\n");
data=(float*)malloc(nSamplesPerSec*SamplesTime*4);//unsigned long是四个字节
for(i=0; i<dataNo; i++)
{data[i]=sin((float)(i)/nSamplesPerSec);
fprintf(fp,"%f\n",data[i]);}}

