none
wav格式的文件,去掉文件头、 RRS feed

答案

  • 你好:

    欢迎来到MSDN中文论坛!

    想要去掉wav的文件头,必须先了解wav的文件格式。请参考这篇文章:

    WAVE PCM soundfile format

    根据这篇文章里面的描述,真正的数据字节应该是从第44位算起,你可以自己测试一下看看读取到的数据是否符合你的要求。

    这里有一个读取wav文件头的方法供你参考:

    public static void ReadWaveHeader(FileStream mFStream)
            {
                Byte[] mBuffer = null;
                mBuffer = new Byte[4];
                //   Read   RIFF   Symbol 
                mFStream.Read(mBuffer, 0, 4);
                Console.WriteLine("00H 4 {0} ", Encoding.ASCII.GetString(mBuffer, 0, 4));
                //   Read   File   Length 
                mFStream.Read(mBuffer, 0, 4);
                Console.WriteLine("04H 4 {0} ", BitConverter.ToInt32(mBuffer, 0));
                //   Read   Wave   Symbol 
                mFStream.Read(mBuffer, 0, 4);
                Console.WriteLine("08H 4 {0} ", Encoding.ASCII.GetString(mBuffer, 0, 4));
                //   Read   Fmt   Symbol 
                mFStream.Read(mBuffer, 0, 4);
                Console.WriteLine("0CH 4 {0} ", Encoding.ASCII.GetString(mBuffer, 0, 4));
                //   Read   unknowed 
                mFStream.Read(mBuffer, 0, 4);
                Console.WriteLine("10H 4 {0} ", BitConverter.ToInt32(mBuffer, 0));
                //   格式类型 
                mFStream.Read(mBuffer, 0, 2);
                Console.WriteLine("14H 4 {0} ", BitConverter.ToInt16(mBuffer, 0));
                //   通道数 
                mFStream.Read(mBuffer, 0, 2);
                Console.WriteLine("16H 2 {0} ", BitConverter.ToInt16(mBuffer, 0));
                //   采样率 
                mFStream.Read(mBuffer, 0, 4);
                Console.WriteLine("18H 4 {0} ", BitConverter.ToInt32(mBuffer, 0));
                //   波形音频数据传送率 
                mFStream.Read(mBuffer, 0, 4);
                Console.WriteLine("1CH 4 {0} ", BitConverter.ToInt32(mBuffer, 0));
                //   数据块调整数 
                mFStream.Read(mBuffer, 0, 2);
                Console.WriteLine("20H 2 {0} ", BitConverter.ToInt16(mBuffer, 0));
                //   样本数据位数 
                mFStream.Read(mBuffer, 0, 2);
                Console.WriteLine("22H 2 {0} ", BitConverter.ToInt16(mBuffer, 0));
                //   数据标记符 
                mFStream.Read(mBuffer, 0, 4);
                Console.WriteLine("24H 4 {0} ", Encoding.ASCII.GetString(mBuffer, 0, 4));
                //   语音数据长度 
                mFStream.Read(mBuffer, 0, 4);
                Console.WriteLine("28H 4 {0} ", BitConverter.ToInt32(mBuffer, 0));
            }


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    2013年11月4日 5:27
    版主