WAVE Format¶
Overview¶
Example of running xxd -l 44 -c 16 <SomeFile.wav>
| (1) | (2) | (3) | (4) |
00000000: 5249 4646 32b0 1e04 5741 5645 666d 7420 RIFF2...WAVEfmt
| (5) |(6) |(7) | (8) | (9) |
00000010: 1200 0000 0300 0600 80bb 0000 0094 1100 ................
|(10)|(11)|
00000020: 1800 2000 0000 6661 6374 0400 .. ...fact..
The 11 binary blocks shown above are:
- The header that reads "RIFF" in ASCII.
- The size (in bytes, little endian) of the rest of the chunk following this number.
- For typical WAV file, the RIFF chunk is basically the only chunk in the file. Hence this number is typically the file size less 8 bytes.
- The size of
32b0 1e04
in little endian means it is of0x041eb032
bytes.
- The format of the chunk.
- For typical WAV file, this reads "WAVE" in ASCII.
- The ID of the first subchunk
- For typical WAV file, the first subchunk is usually "fmt " (it's "fmt" with a trailing white space to make it 4 bytes in total length).
- The size (in bytes, little endian) of the rest of the subchunk following this number.
- The audio format (little endian) such as PCM or float
- The possible values are listed in https://docs.microsoft.com/en-us/windows/desktop/api/mmreg/ns-mmreg-twaveformatex as "wFormatTag Value." However, the page shows only the symbol names without its actual integer values. Some widely known values are
- WAVE_FORMAT_PCM: 0x0001
- WAVE_FORMAT_IEEE_FLOAT: 0x0003
- WAVE_FORMAT_EXTENSIBLE: 0xFFFE
- The possible values are listed in https://docs.microsoft.com/en-us/windows/desktop/api/mmreg/ns-mmreg-twaveformatex as "wFormatTag Value." However, the page shows only the symbol names without its actual integer values. Some widely known values are
- The number of channels (little endian)
- Sampling Rate (number of samples per second per channel, little endian)
- Byte Rate (little endian)
- BlockAlign
- BitsPerSample