Not a Member Yet,
Click here to Register

ID: 398
Viewed: 3546
Added: Aug 19, 2002
Version:
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

Disecting WAV Files

Highlight all by clicking in box
<!---Declaration--->
Option Explicit

Private Type WaveHeader ' 12 bytes
riff As String * 4
bytes As Long
wave As String * 4
End Type
'
Private Type WaveFormat ' 22 bytes
fmt As String * 4
chunkSize As Long
formatTag As Integer
channels As Integer
samplesPerSecond As Long
aveBytesPerSecond As Long
blockAlign As Integer
bitsPerSample As Integer
End Type

Highlight All
<!---Code--->
Private Sub ShowWavHeaderDetails(ByVal sWavFileName As String)
'
Dim FileNum As Integer
Dim wh As WaveHeader
Dim wf As WaveFormat
FileNum = FreeFile
'
If Len(sWavFileName) > 0 Then
Open sWavFileName For Binary As FileNum
Get #FileNum, , wh
Get #FileNum, , wf
Close FileNum
Debug.Print w.riff
Debug.Print "Bytes: " & CStr(wh.bytes + 8)
Debug.Print wh.wave
Debug.Print wf.fmt
Debug.Print CStr(wf.chunkSize) & " (bytes per chunk)"
Debug.Print IIf(wf.formatTag = 1, "Uncommpressed", "Compressed")
Debug.Print IIf(wf.channels = 1, "Mono", "Stereo")
'can be mutiple channels too (i.e. Quad)
Debug.Print "Sampling Rate: " & CStr(wf.samplesPerSecond)
Debug.Print "Bytes Per Second: " & CStr(wf.aveBytesPerSecond)
Debug.Print "Sample size in bytes: " & CStr(wf.blockAlign)
Debug.Print CStr(wf.bitsPerSample) & " Channels"
'not correct for Layer3 WAV
Debug.Print CStr((wh.bytes - 26) / wf.aveBytesPerSecond) & " seconds"
End If
End Sub
;


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2024 snippetlibrary.com All Rights Reserved. Conditions
Do NOT follow this link or you will be banned from the site!