Private Sub GetDat(ByVal fn As String)
Dim idx1 As Integer
Dim chunksize, wavechunksize As Int32
Dim samplerate, bytespersecond As Int32
Dim subchunk2size As Int32
Dim wavetype, numchannels As Int16
Dim blockalign, bitspersample As Int16
Dim rif, wav, fmt, subchunk2id As String
Dim buffer(100000) As Byte
' "RIFF" bytes 0 to 3
' filesize-8 (normally) bytes 4 to 7
' "WAVE" bytes 8 to 11
' "fmt " bytes 12 to 15
' size of wave chunk bytes 16 to 19
' wave type format bytes 20 to 21
' number of channels bytes 22 to 23
' sample rate bytes 24 to 27
' bytes per second bytes 28 to 31
' block align bytes 32 and 33
' bits per sample bytes 34 to 35
' sub chunk 2 id bytes 36 to 39
' sub chunk 2 size bytes 40 to 43
Dim fs As New FileStream(fn, FileMode.Open)
Dim br As New BinaryReader(fs)
br.Read(buffer, 0, 44)
rif = BitConverter.ToString(buffer, 0, 4)
chunksize = BitConverter.ToInt32(buffer, 4)
wav = BitConverter.ToString(buffer, 8, 4)
fmt = BitConverter.ToString(buffer, 12, 4)
wavechunksize = BitConverter.ToInt32(buffer, 16)
wavetype = BitConverter.ToInt16(buffer, 20)
numchannels = BitConverter.ToInt16(buffer, 22)
samplerate = BitConverter.ToInt32(buffer, 24)
bytespersecond = BitConverter.ToInt32(buffer, 28)
blockalign = BitConverter.ToInt16(buffer, 32)
bitspersample = BitConverter.ToInt16(buffer, 34)
subchunk2id = BitConverter.ToString(buffer, 36, 4)
subchunk2size = BitConverter.ToInt32(buffer, 40)
br.Read(buffer, 44, 256)
End Sub
This is the first part of the wav file that was loaded
This is a standard wave file
: 49 : 46 : 46 : C0 : 5F : 01 : 00 : 57 : 41 : 56 : 45 : 66 : 6D : 74 : 20 : 10
: 00 : 00 : 00 : 01 : 00 : 01 : 00 : 44 : AC : 00 : 00 : 88 : 58 : 01 : 00 : 02
: 00 : 10 : 00 : 64 : 61 : 74 : 61 : 9C : 5F : 01 : 00 : 6F : 00 : 83 : 00 : 84
: 00 : 89 : 00 : 85 : 00 : 82 : 00 : 7B : 00 : 78 : 00 : 71 : 00 : 71 : 00 : 71
: 00 : 74 : 00 : 76 : 00 : 7B : 00 : 7C : 00 : 7D : 00 : 7F : 00 : 7B : 00 : 7B
: 00 : 78 : 00 : 77 : 00 : 73 : 00 : 79 : 00 : 72 : 00 : 7A : 00 : 78 : 00 : 7A
: 00 : 7C : 00 : 7A : 00 : 7B : 00 : 7B : 00 : 77 : 00 : 79 : 00 : 76 : 00 : 77
: 00 : 78 : 00 : 76 : 00 : 7B : 00 : 77 : 00 : 7C : 00 : 78 : 00 : 7B : 00 : 7A