Home

subchunk

A subchunk is a subdivision within a chunk in RIFF- and IFF-based file formats. Each subchunk has a four-character ASCII ID, a four-byte unsigned integer size, and a data payload of that size. Subchunks allow a file to store multiple types of information in a flexible, extensible way. In WAV audio files, which use the RIFF container, subchunks organize format metadata and data.

In WAV, the file starts with a RIFF chunk that declares the container type (such as "WAVE")

When reading, software processes each subchunk by reading its 4-byte ID and the 4-byte size, then consuming

and
contains
several
subchunks.
The
most
common
are
the
format
subchunk
"fmt
"
and
the
data
subchunk
"data".
The
fmt
subchunk
encodes
audio
format,
number
of
channels,
sample
rate,
byte
rate,
block
align,
and
bits
per
sample.
The
data
subchunk
contains
the
raw
audio
samples
and
its
size
equals
the
number
of
bytes
of
sample
data.
Other
subchunks,
such
as
"LIST"
for
metadata
or
"fact"
for
certain
compressed
formats,
may
appear.
Subchunks
are
arranged
sequentially
within
the
parent
chunk
and
may
be
padded
to
align
on
even-byte
boundaries.
size
bytes
of
payload
before
continuing
to
the
next
subchunk.
Because
some
formats
use
odd
lengths,
a
single
padding
byte
may
be
added
after
an
odd-sized
subchunk
data
to
preserve
alignment.
The
concept
of
subchunks
is
common
in
RIFF-family
formats,
enabling
extensibility
without
changing
the
overall
container
structure.