Re: Wave File Header Size



On Thu, 29 Mar 2007 17:48:18 -0400, "Scott McPhillips [MVP]"
<org-dot-mvps-at-scottmcp> wrote:

skibud2 wrote:
I have a .wav file. It is compressed with 8Khz ADPCM compession. Here
is a snap shot of the header:

00000000: 5249 4646 6c96 0000 5741 5645 666d 7420 RIFFl...WAVEfmt
00000010: 3200 0000 0200 0100 401f 0000 0010 0000 2.......@.......
00000020: 0001 0400 2000 f401 0700 0001 0000 0002 .... ...........
00000030: 00ff 0000 0000 c000 4000 f000 0000 cc01 ........@.......
00000040: 30ff 8801 18ff 6661 6374 0400 0000 2025 0.....fact.... %
00000050: 0100 6461 7461 1a96 0000 0010 0000 0000 ..data..........

The 'data' string doesn't happen to 0x52. Every webpage that I have
found say that the wave header says that it should be 44 bytes. Am I
missing something? Where can I find the appropriate header structure?
This file plays perfectly fine on the PC.

The file format permits optional chunks. You can never assume that the
header is a fixed number of bytes. It looks like your file contains an
optional "fact" chunk, which is a fine example of what can be
encountered. You might also encounterd optional chunks containing a
copyright, song title, etc., etc., etc.

You can find a specification of the file format at wotsit.org, and
sample code in MSDN for parsing the chunks. A shortcut: search for the
"data" string in the header.

--

As I recall, the RIFF format is pretty clear on what
chunks may be encountered, but pretty UNclear on
what order they may appear in. Like, can any other
chunks besides "fact" appear before "data"? Or
should they always appear after it?

Those questions are relevant when creating files.
The only approved strategy when reading files is to
read all the chunk descriptors and ignore any
chunks you don't understand. The RIFF format
was designed to make that easy, since each chunk
tells you how many bytes to skip, in the size field
right after the name.

Best regards,


Bob Masta

D A Q A R T A
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Scope, Spectrum, Spectrogram, Signal Generator
Science with your sound card!
.



Relevant Pages

  • Re: legality/practicality of nesting complete, valid HTML pages
    ... content files must NOT contain header or trailer material. ... but we need to learn to live with the disadvantages. ... design, as long as the content chunks are in separate files. ... One reply offered an alternative of reading the content chunks into a buffer ...
    (comp.infosystems.www.authoring.html)
  • Re: Cartridge files converting back to .ROM/.BIN ? How ?
    ... Peter Dassow (remove the NOSPAM. ... greater than 16KB typically have chunks, means 2KB or 4KB blocks, ... Vindicators, which has 64KB, and there is *not* only a header first. ... bank switching was made via software to move between each of them. ...
    (comp.sys.cbm)
  • Re: Wave File Header Size
    ... found say that the wave header says that it should be 44 bytes. ... The file format permits optional chunks. ... You can find a specification of the file format at wotsit.org, and sample code in MSDN for parsing the chunks. ... search for the "data" string in the header. ...
    (microsoft.public.win32.programmer.mmedia)
  • Re: Are WAV files dangerous?
    ... The header is a fixed ... |length header and the rest is pure data. ... The .wav file can contain many chunks that vary in length. ...
    (comp.security.misc)
  • Re: Are WAV files dangerous?
    ... The header is a fixed ... |length header and the rest is pure data. ... The .wav file can contain many chunks that vary in length. ...
    (alt.computer.security)