Document directory
- Notes:
- General discussion of riff files:
- References:
The wave file format is a subset of Microsoft's Riff specification for the storage of multimedia files. A riff file starts out with a file header followed by a sequence of data chunks. A wave file is often just a riff file with a single "wave" chunk which consists of two sub-Chunks -- a "FMT" chunk specifying the data format and a "data" chunk ining the actual sample data. call this form the "canonical form ". who knows how it really all works.
I use the standard wave format as created by the Sox program:
Offset size Name Description
2ExtraparamsizeIf PCM, then doesn' t exist
XExtraparamsSpace for extra parameters
The "data" subchunk contains the size of the data and the actual sound:
36 4Subchunk2idContains the letters "data"
(0x64617461 big-Endian form ).
40 4Subchunk2size= Numsamples * numchannels * bitspersample/8
This is the number of bytes in the data.
You can also think of this as the size
Of the read of the subchunk following this
Number.
44 *DataThe actual sound data.
As an example, here are the opening 72 bytes of A wave file with Bytes shown as hexadecimal numbers:
52 49 46 46 24 08 00 00 57 41 56 45 66 6D 74 20 10 00 00 00 01 00 02 00
22 56 00 00 88 58 01 00 04 00 10 00 64 61 74 61 00 08 00 00 00 00 00
24 17 1E F3 3C 13 3C 14 16 F9 18 F9 34 E7 23 A6 3C F2 24 F2 11 ce 1A 0d
Here is the interpretation of these bytes as a wave soundfile:
Notes:
- The default byte ordering assumed for wave data files is little-Endian. Files written using the big-Endian byte ordering scheme have the identifier rifx instead of riff.
- The sample data must end on an even byte boundary. Whatever that means.
- 8-bit samples are stored as unsigned bytes, ranging from 0 to 255. 16-bit samples are stored as 2's-complement signed integers, ranging from-32768 to 32767.
- There may be additional subchunks in a wave data stream. If so, each will have a char [4] subchunkid, and unsigned long subchunksize, and subchunksize amount of data.
- Riff standsResource Interchange File Format.
General discussion of riff files:
Multimedia applications require the storage and management of a wide variety of data, including bitmaps, audio data, video data, and peripheral device control information. riff provides a way to store all these varied types of data. the type of data a riff file contains is indicated by the file extension. examples of data that may be stored in riff files are:
- Audio/visual interleaved data (. AVI)
- Waveform data (. wav)
- Bitmapped data (. RDI)
- MIDI information (. Rmi)
- Color palette (. Pal)
- Multimedia movie (. rmn)
- Animated Cursor (. Ani)
- A bundle of other riff files (. BND)
Note: At this point, AVI files are the only type of riff files that have been fully implemented using the current riff specification. although wav files have been implemented, these files are very simple, and their developers typically use an older specification in constructing them.
For more info see http://www.ora.com/centers/gff/formats/micriff/index.htm
References:
- Riff format reference (good) http://netghost.narod.ru/gff/graphics/summary/micriff.htm ).
- Http://www.lightlink.com/tjweber/StripWav/WAVE.html