首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

wav文件提取出pcm数据

/******************************************************************************************************* 文件功能:wav文件中提取pcm数据 作者:HFL 日期:2014-1-12 说明:wav文件就是在pcm数据的基础上加了一文件头。文件头的大小为44个字节(没有附件字段的情况,如果有附加字段问46个字节)       ,剔除文件头,就是纯pcm采样过来的数据。  pcm构成要素:采样率 ,声道个数,数据符号特性(一般8位都是无符号的) ********************************************************************************************************/ #include<stdio.h> #include<stdlib.h> void main() { FILE *infile, *outfile; char *buf = NULL; long length;    if((infile = fopen ("e:\\1.wav", "rb+"))==NULL) { printf("Open the 1.wav failed\n"); return ; } else { printf("Open the 1.wav success\n"); } if((outfile = fopen ("e:\\2.pcm", "wb"))==NULL) { printf("Open the 2.pcm failed\n"); return ; } else { printf("Open the 2.pcm success\n"); } /*获取文件的长度*/ fseek(infile,0,SEEK_END); length=ftell(infile); buf = (char*)malloc(length-43);/*文件数据段长度等于文件总长度-文件头长度位置*/

03
领券