打印本文 打印本文 关闭窗口 关闭窗口
VB.NET实现DirectSound9 (7) 录音
作者:武汉SEO闵涛  文章来源:敏韬网  点击数10921  更新时间:2009/4/23 19:00:44  文章录入:mintao  责任编辑:mintao
ytes for data chunk description + actual sample data size.)

        ''''

        ''''   Bytes(8 - 11) ''''W'''' ''''A'''' ''''V'''' ''''E''''

        ''''

        ''''

        ''''

        '''' The 24 byte FORMAT chunk is constructed like this:

        ''''

        ''''   Bytes(0 - 3) ''''f'''' ''''m'''' ''''t'''' '''' ''''

        ''''

        '''' Bytes 4 - 7 : The format chunk length. This is always 16.

        ''''

        '''' Bytes 8 - 9 : File padding. Always 1.

        ''''

        '''' Bytes 10- 11: Number of channels. Either 1 for mono,  or 2 for stereo.

        ''''

        '''' Bytes 12- 15: Sample rate.

        ''''

        '''' Bytes 16- 19: Number of bytes per second.

        ''''

        '''' Bytes 20- 21: Bytes per sample. 1 for 8 bit mono, 2 for 8 bit stereo or

        ''''

        ''''                   16 bit mono, 4 for 16 bit stereo.

        ''''

        '''' Bytes 22- 23: Number of bits per sample.

        ''''

        ''''

        ''''

        '''' The DATA chunk is constructed like this:

        ''''

        ''''   Bytes(0 - 3) ''''d'''' ''''a'''' ''''t'''' ''''a''''

        ''''

        '''' Bytes 4 - 7 : Length of data, in bytes.

        ''''

        '''' Bytes 8 -...: Actual sample data.

        ''''

        ''''

        ''''

        ''''**************************************************************************

 

        '''' Open up the wave file for writing.

        WaveFile = New FileStream(TextBox1.Text, FileMode.Create)

        Writer = New BinaryWriter(WaveFile)

 

        '''' Set up file with RIFF chunk info.

        Dim ChunkRiff As Char() = {"R", "I", "F", "F"}

        Dim ChunkType As Char() = {"W", "A", "V", "E"}

        Dim ChunkFmt As Char() = {"f", "m", "t", " "}

        Dim ChunkData As Char() = {"d", "a", "t", "a"}

 

        Dim shPad As Short = 1 '''' File padding

        Dim nFormatChunkLength As Integer = &H10 '''' Format chunk length.

        Dim nLength As Integer = 0 '''' File length, minus first 8 bytes of RIFF description. This will be filled in later.

        Dim shBytesPerSample As Short = 0 '''' Bytes per sample.

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ...  下一页 >> 

打印本文 打印本文 关闭窗口 关闭窗口