WAV文件格式

来源:互联网 发布:java正则匹配包含邮箱 编辑:程序博客网 时间:2024/05/21 18:49

WAV为微软公司(Microsoft)开发的一种声音文件格式,它符合RIFF(Resource Interchange File Format)文件规范,用于保存Windows平台的音频信息资源,被Windows平台及其应用程序所广泛支持,该格式也支持MSADPCM,CCITT A LAW等多种压缩运算法,支持多种音频数字,取样频率和声道,标准格式化的WAV文件和CD格式一样,也是44.1K的取样频率,16位量化数字,因此在声音文件质量和CD相差无几! WAV打开工具是WINDOWS的媒体播放器。


类似与TCP/IP包头

//wav音频头部格式typedef struct _wave_pcm_hdr{charriff[4];//="RIFF"intsize_8;//=FileSize=8charwave[4];//="WAVE"charfmt[4];//="fmt"intfmt_size;//=下一个结构体的大小:16short intformat_tag;//=PCM:1short intchannels;//=通道数:1intsamples_per_sec;//=采样率:8000|6000|16000intavg_bytes_per_sec;//=每秒字节数:samples_per_sec*bit_per_sampleshort intblock_align;//=每采样点字节数:wBitsPerSample/8short intbits_per_sample;//=量化比特数:8|16chardata[4];//="data";intdata_size;//=纯数据长度:FileSize-44}wave_pcm_hdr;/*默认wav音频头部数据*/wave_pcm_hdr default_wav_hdr ={{ 'R', 'I', 'F', 'F' },0,{ 'W', 'A', 'V', 'E' },{ 'f', 'm', 't', ' ' },16,1,1,16000,32000,2,16,{ 'd', 'a', 't', 'a' },0};


1 0