用8051采用pwm方式播放 串口语音数据

源代码在线查看: wav.c

软件大小: 12 K
上传用户: guo25621286
关键词: 8051 pwm 方式 播放
下载地址: 免注册下载 普通下载 VIP

相关代码

				/***************************************************************************
				* NAME:         wav.h
				*----------------------------------------------------------------------------
				* Copyright (c) coolfire.
				*----------------------------------------------------------------------------
				data: 6/30/07     
				*--------------------------------------------------------------------------*/
				#include "wav.h"
				/*
				Byte data[4096];
				Uint32 datalen;
				Uint32 filelen;
				
				riff_struct *riff_data;
				fmt_struct *fmt_data;
				wav_struct *wav_data;
				
				wav(Uchar *src)
				{
				
				  int fb,Len; 
				  FILE *fp;
				  Byte len;
				
					fb = open(src, O_RDWR);
				   Len=read(fb,riff_data,12);
				   Len=read(fb,fmt_data,24);
				   Len=read(fb,wav_data,8);
				   
				   filelen=lseek(fb,54,SEEK_SET);
				   printf("filelen=%d\n",filelen);
				   datalen=lseek(fb,0,SEEK_END)-filelen;
				   printf("datalen=%d\n",datalen);
				   Len=lseek(fb,44,SEEK_SET);
				   Len=read(fb,data,datalen);
				   return WAV_OK; 
				}
				
				int main()
				{
				 FILE *fp;
				 
				 wav("/root/ha.wav");
				 
				 if((fp=fopen("ha.c","wb"))==NULL)
				   return 0;
				 fwrite(data,sizeof(Byte),2000,fp);
				 fclose(fp);
				 return 0;
				}
				*/
							

相关资源