Free 30-day trial. macOS first. Join the waitlist.
← Formats

.wav

What is in a WAV besides the audio.

What it is

A WAV file is a RIFF container. It opens with the letters RIFF, a size, and the word WAVE, and everything after that is a series of chunks. Each chunk announces itself with a four character name and its own length, so a reader can walk the file and skip anything it does not understand.

Two chunks carry the audio. fmt says how the samples are encoded and data holds them. Everything else in the file is metadata, and that is where the interesting part is for anyone loading samples into an instrument.

RIFF ....WAVE
  fmt    16 bytes    how the audio is encoded
  data   the audio
  smpl   60 bytes    root note and loop points
  LIST   optional    names, comments, software

What is inside

The chunk a sampler cares about is smpl. It's optional, most audio editors never write one, and it's the difference between a file that maps itself and a file the sampler has to guess at.

smpl chunk, from the start of its data
  28   number of loops
  12   MIDI unity note, the pitch it was recorded at
  36   first loop record
    +8   loop start, in sample frames
    +12  loop end, in sample frames

Vocabulary

Producers say sample for a whole file. The format says sample for one number in one channel, and calls the thing you play a frame. Loop points are counted in frames, which is why the same loop is a different number at a different sample rate.

The root note is stored as the MIDI unity note. Kontakt and Logic call it the root key, SFZ calls it pitch_keycenter and the MPC calls it the root note. Same number, four names.

What reads it

Effectively everything. What varies is how much of the metadata a program bothers to read: plenty of samplers load the audio and ignore the loop points sitting right there in the file.

A format code of 1 in the fmt chunk means integer PCM and 3 means floating point. There is a third value, 0xFFFE, which means the real answer is buried in a SubFormat field further into the same chunk. A reader that stops at the first number gets it wrong on any file written that way.

Why your loops disappear

Loop points live in the smpl chunk and nowhere else. Most DAWs will happily bounce a file without one, and many editors drop the chunk when they save, so a carefully looped sample can come out of a round trip with the loop gone and no warning anywhere.

The audio is untouched, which is what makes it confusing. The file sounds identical and stops sustaining when you hold a key, because the sampler has nothing to loop between.

The limits

Chunk sizes are 32 bit, so a plain WAV cannot exceed four gigabytes. Longer recordings need RF64 or Wave64, which are different formats wearing a similar name.

Chunks are word aligned, so one with an odd length is followed by a padding byte that is not counted in its size. A writer that forgets it produces a file that some readers parse and others reject, which is a hard bug to see from the outside.