A file with no header can only be identified by reading it. Each wrong guess has its own symptom, and sound is a very particular kind of signal: neighbouring samples are close to each other. The right reading of audio is smooth; nearly every wrong reading is rough. This page lists the symptoms, then the tests the explorer makes.
Steps by hand
- Is there a header? Look at the first bytes:
RIFF,FORM,.snd,caff,fLaC,OggS,ID3. The explorer does this and says so in a Header and name section. Otherwise a few dozen bytes of near-constant values then data is a header of its own, which Skip removes. - Does the size say anything? The size must be a whole number of frames. A size divisible by 2 but not 4 rules out 32-bit stereo; one divisible by 3 suggests 24-bit.
- Try the width. 16-bit little-endian signed is the commonest by far, then 8-bit unsigned, 32-bit float, 24-bit, µ-law.
- Fix the byte order, sign and channels using the symptoms below.
- Fix the rate by the length or the pitch (Sample rates).
What each wrong reading looks like
| Wrong in | Waveform | Sound |
|---|---|---|
| Byte order (16-bit) | noise filling the whole range; a faint wave may show under it | loud hiss; the tune very faintly if at all |
| Sign (unsigned read as signed or the reverse) | the right wave but jumping between the top and bottom of the range each time it crosses its middle; no samples near the centre | the right sound, with a loud buzz or crackle at the pitch of the sound |
| Width (16-bit read as 8-bit) | the wave with noise between every other sample, at twice the length | the sound, an octave low and twice as long, buried in noise |
| Width (8-bit read as 16-bit) | half the samples and a little noise; the wave is smooth but half as long | the sound, an octave high, with a faint hiss |
| Float read as integer, or integer as float | tiny or absurdly large and sometimes silent; huge spikes | silence, or clicks |
| Channels (stereo read as mono) | twice as long; where the channels differ, a rough doubled edge | an octave low, twice as long |
| Rate | the same wave | the right sound, too fast and high or slow and low |
| Law (µ-law read as A-law or the reverse) | a wave of the same shape with its amplitudes altered | distorted, though the sound is still recognisable |
| An ADPCM block size | recovers at every block start and drifts or goes wild between | the right sound, then noise, over and over at the block rate |
What the explorer scores
Choosing Detect in the options bar, or reading the Detected formats table, shows what the explorer found. It reads a window of up to 256 KB from the first non-constant bytes after the Skip, decodes the first 32,768 frames as each of 17 readings (8-bit signed and unsigned; 16-bit signed and unsigned in both orders; 24-bit signed in both orders and unsigned little-endian; 32-bit signed in both orders; 32 and 64-bit floats in both orders; µ-law; A-law) as mono and as stereo, and measures each reading:
| Test | What it measures | Healthy audio |
|---|---|---|
| Roughness | the mean step between neighbouring samples divided by the mean distance from the average | small, 0.01 to 0.3; white noise is about 1.1 to 1.4 |
| Big jumps | the share of steps over half the range | about 0; a wrong sign, order or width gives many |
| Zero crossings | how often the wave crosses its average | low (under 0.3); noise is near 0.5 |
| Clipping | samples at full scale | few; many suggest a saturated wrong reading |
| DC offset | the average against the range | small; a reading whose average is more than half of its half-range off centre is demoted |
| Valid floats | the share of floats that are numbers within ±2 | all of them |
| Entropy and steadiness | spread of the level histogram, and how much the loudness varies over 16 blocks of the window | shown for judging; they carry no weight in the score |
The score runs from 0 to 100 and is a ranking, not a probability. Two rules break ties that the tests cannot: a reading of wide samples that is no smoother than the same bytes read as twice as many narrow channels (a 32-bit mono reading of 16-bit stereo) is demoted, and a 32-bit integer reading is demoted when the float reading of the same bytes is valid, because a smooth float wave looks smooth as integers as well. A stereo reading has to be clearly smoother than the mono one to rank above it.
A third rule: a float reading that sits at full scale (clamped to ±1) for more than a fifth of its samples is demoted to 35 % of its score, because that is what integers read as floats look like (their bit patterns are huge numbers) and no float recording clips that much.
On built files (a chord with noise and a plucked tone, in 13 formats, mono and stereo) the first
choice was right for all 54 files, including two real ones (a 16-bit speech
recording and a 32-bit float wavetable), and the right reading was in the first three for all 52 built ones. Before the third rule two 32-bit integer files were
ranked as 32-bit float. On nine real files from libsndfile’s test set (16, 24 and 32-bit integers, signed and unsigned 8-bit, 32 and 64-bit floats, A-law and µ-law)
the first choice was right for all nine (test-pcm-real.mjs; the 32-bit integer file was the one the third rule corrected).
Not sound at all. Before ranking, the explorer looks for the preamble of an IEC 61937 or SMPTE 337M data burst in the first mebibyte (the bytes F8 72 4E 1F or
72 F8 1F 4E for 16-bit words, and the 24-bit forms): a compressed AC-3 or DTS stream carried as PCM ranks as loud noise and nothing in the table would say why. A match is shown as
This is not sound and listed as a problem. See S/PDIF, AES3 and HDMI captures.
Limits. Readings that differ only in samples carrying very little of the signal cannot be told apart: 8-bit audio reads as a smooth, half-length 16-bit wave; a stereo file with two identical channels reads equally well as mono; very quiet or very short files give a few meaningful samples; a file that is all one value gives nothing to rank. Compressed audio (a coded stream) ranks nothing high, because it is noise-like by design. The ADPCM, DPCM, packed and one-bit formats are never guessed: no test can tell their codes from noise without trying the format.
The file name
A name carries hints the bytes cannot: the explorer reads s16le, pcm_u8, f32le,
mulaw and the other FFmpeg format names, 16bit, 8bit, mono, stereo,
2ch, 6ch, a rate as 44100, 44100hz, 16k, 44k1
or, for radio files, 2400k, 2.4msps. A hint fills an Auto field in the options bar; it is
not used for choosing a ranked reading.