presentations/audiocodecs/slides/04-2-wavformat.md

67 lines
2 KiB
Markdown
Raw Normal View History

2024-09-16 21:27:30 -04:00
<div style="text-align: center; display: grid; grid-template-columns: 1fr 1fr;">
<div> <!-- Left pane -->
<!-- Title -->
<div style="font-size: 0.33em;">
| WAV/RIFF Header Format |
| :------: |
| FileTypeBlocID<br>4 bytes<br><br><br> |
| FileSize<br>4 bytes<br><br><br> |
| FileFormatID<br>4 bytes<br><br><br> |
| FormatBlocID<br>4 bytes<br><br><br> |
| BlocSize<br>4 bytes<br><br><br> |
| AudioFormat<br>2 bytes |
| NbrChannels<br>2 bytes |
| Frequence<br>4 bytes<br><br><br> |
| BytePerSec<br>4 bytes<br><br><br> |
| BytePerBloc<br>2 bytes |
| BitsPerSample<br>2 bytes |
</div>
</div>
<div> <!-- Right pane -->
<!-- Title -->
<div style="font-size: 0.33em;">
| WAV Data Chunk Format |
| :------: |
| DataBlocID<br>4 bytes<br><br><br> |
| DataSize<br>4 bytes<br><br><br> |
| SampledData<br>2-3 bytes typically<br><br><br> |
</div>
</div>
</div>
Note:
So easy in fact that I can just show you the entire format.
```
[Master RIFF chunk]
FileTypeBlocID (4 bytes) : Identifier « RIFF » (0x52, 0x49, 0x46, 0x46)
FileSize (4 bytes) : Overall file size minus 8 bytes
FileFormatID (4 bytes) : Format = « WAVE » (0x57, 0x41, 0x56, 0x45)
[Chunk describing the data format]
FormatBlocID (4 bytes) : Identifier « fmt␣ » (0x66, 0x6D, 0x74, 0x20)
BlocSize (4 bytes) : Chunk size minus 8 bytes, which is 16 bytes here (0x10)
AudioFormat (2 bytes) : Audio format (1: PCM integer, 3: IEEE 754 float)
NbrChannels (2 bytes) : Number of channels
Frequence (4 bytes) : Sample rate (in hertz)
BytePerSec (4 bytes) : Number of bytes to read per second (Frequence * BytePerBloc).
BytePerBloc (2 bytes) : Number of bytes per block (NbrChannels * BitsPerSample / 8).
BitsPerSample (2 bytes) : Number of bits per sample
[Chunk containing the sampled data]
DataBlocID (4 bytes) : Identifier « data » (0x64, 0x61, 0x74, 0x61)
DataSize (4 bytes) : SampledData size
SampledData
```
[comment]: # (!!!) <!--------------------------------------------------------->