File formats

Audio to MIDI: the container fails first.

An AIFF, CAF, WMA or MP2 export never reaches the note detector at all — the browser refuses the container and the page can only say Unable to decode audio data. And a WAV whose samples are stored big-endian decodes cleanly, reports success, and returns C3 E4 G3 for a phrase that is C4 E4 G4.

Select an audio file to create a MIDI draft locally.

🔒 The selected audio is decoded in your browser; it is not uploaded to a server.

The rule

The first gate is the browser's decoder, and it runs before any pitch is measured.

The converter never parses an audio file. It hands the bytes to the browser's own decodeAudioData, gets back a buffer of samples, and only then starts looking for pitches. Everything on this page is about that first handover, which means it is a property of the browser and the container — not of the melody, the playing, or the note detector.

That has one consequence worth stating plainly, because it is the source of almost every "it will not take my file" report. A format that fails here fails completely: no buffer comes back, no window is analysed, no note is estimated. There is nothing to improve by re-recording, normalising, trimming silence or moving the sensitivity slider, because none of that code ever runs.

The file control advertises accept="audio/*,.wav,.mp3,.m4a,.ogg,.flac". The wildcard is what makes this confusing: it tells the operating system's file picker to let you select anything whose type starts with audio/, and AIFF, CAF, WMA and MP2 all do. The visible copy under the control, meanwhile, names five formats. So the picker accepts a file the page's own promise does not cover, and the failure surfaces only after you press Convert.

Measured

Seventeen containers, one source signal: thirteen decode, four do not.

One signal was encoded seventeen ways and each file was decoded and then fed to the same detector. The source is a three-note phrase — C4, E4, G4, 0.45 s each, 5 harmonics, 44.1 kHz mono — so a working container should return exactly MIDI 60, 64, 67. Anything else is either a refusal or a corrupted read. Decoding was done by the browser at its own context rate; the file's stored sample rate never reaches the detector, because the decoded buffer always reports 44,100 Hz.

Container / encodingDecodesNotes returned
WAV 16-bit PCMyes60, 64, 67
WAV 24-bit PCMyes60, 64, 67
WAV 32-bit floatyes60, 64, 67
WAV 8-bit PCMyes60, 64, 67
WAV at 8 kHzyes60, 64, 67
WAV at 96 kHzyes60, 64, 67
WAV stereoyes60, 64, 67
FLACyes60, 64, 67
OGG Vorbisyes60, 64, 67
Opus in OGGyes60, 64, 67
Opus, raw containeryes60, 64, 67
AAC in M4Ayes60, 64, 67
AAC in MP4yes60, 64, 67
AIFF 16-bitno—
CAF (Core Audio)no—
WMA v2no—
MP2no—

Every file encoded from the same three-note WAV with ffmpeg, plus a hand-written AIFF container as a control. Balanced sensitivity. Detector 77a9dd6b, 8,069 B, read from the production converter.js. Reproduction: node run-codec-formats-1204.js, group A.

The pattern in the fourteen successful rows matters as much as the four failures: bit depth, sample rate and channel count changed nothing. Eight-bit and 32-bit float both return the same three pitches at the same three start times. An 8 kHz file and a 96 kHz file both come back at 44,100 Hz with identical notes, because the browser resamples on decode and this three-note phrase tops out at 392 Hz — far below the 4 kHz ceiling of the 8 kHz file. That last point is a limit of this test rather than a general result, and it is why the sample-rate page exists: put content near the top of a low-rate file's band and the resampling has nothing to recover.

So "does this converter take my format" is not a question about audio quality at all. PCM depth, rate and channel layout are all absorbed without a single changed note. What separates the top of that table from the bottom is whether the browser implements a decoder for the container.

The expensive one

AIFF fails in every variant, and the audio inside it is byte-for-byte the WAV that works.

AIFF is worth isolating because it is the default export of Logic Pro and GarageBand, so a large share of Mac-made recordings arrive in it. Seven variants were tried: 16- and 24-bit, 44.1 and 48 kHz, mono and stereo, the .aif extension, AIFF-C, and a hand-written container built to exclude anything ffmpeg does specially. All seven were refused with the same EncodingError. Nothing about depth, rate or channel count changed the outcome, which is the same signal as the WAV rows — these are not the variable.

The decisive test is what is inside the file. An AIFF stores its samples in SSND; a WAV stores them in data. Extracting both chunks and comparing them sample by sample, the 228,438 payload bytes of the AIFF are exactly the byteswap of the WAV's payload — zero mismatched pairs, big-endian against little-endian, same 114,219 frames, same 16 bits, same 44.1 kHz. In other words the recording reaches this converter twice, once in a form it reads perfectly and once in a form it cannot open at all, and the only difference is how the container labels the bytes.

A second pair of files settles whether the name on the file matters. A WAV renamed to .aiff decodes fine and returns C4 E4 G4, because decodeAudioData sniffs the leading bytes rather than trusting the extension. An AIFF renamed to .wav still fails, for the same reason. Renaming is therefore not a workaround in either direction: it cannot break a good file and it cannot rescue a bad one.

Container tags read from the first twelve bytes of each file (FORM/AIFF versus RIFF/WAVE). Payload comparison over all 114,219 frames. Reproduction: node run-codec-formats-1204.js, groups B and C, and node probe-aiff-1203.js.

The quiet failure

A byte-swapped WAV decodes without complaint and returns the wrong notes.

An AIFF at least tells you it failed. There is a worse case, and it is the reason this page exists rather than a single sentence about supported formats.

Take the working 16-bit WAV and swap every pair of sample bytes, leaving the header untouched: it still says RIFF/WAVE, still says 16 bits, still says 44.1 kHz, and now every sample is wrong. The browser decodes it happily — there is nothing malformed to reject, because the header is valid and the sample count is right. The detector then returns three notes, reports a successful conversion, and offers the download.

FileDecodesPeak / RMSNotes returned
WAV, little-endian (source)yes0.208 / 0.07960, 64, 67 — C4 E4 G4
WAV, samples byte-swappedyes1.000 / 0.42948, 64, 55 — C3 E4 G3

Same 114,219 frames, same header fields, only the byte order of the sample payload reversed. Balanced. Reproduction: node run-codec-formats-1204.js, group D.

Two of the three notes are wrong, and one of them moved by a full octave. Nothing on the page says so: the status line reads Created a MIDI draft with 3 notes, the download button appears, and the file is written. A user comparing the result against what they played would conclude the converter is inaccurate on their material, when in fact the samples it received were never the samples that were recorded.

The corruption is visible in one number if you look for it. Peak jumps from 0.208 to 1.000 and RMS from 0.079 to 0.429 — a file that is suddenly five times louder and pinned at full scale. Swapping bytes turns small values into large ones, because the high byte of a near-silent sample becomes the low byte of a loud one. Twenty-one samples sit at or above 0.9999, so the buffer is right at the clipping ceiling. This is what a byte-order mistake looks like in a waveform: not noise, but the same shape distorted upward.

The practical point is that success and correctness are separate events here. A refused file costs you a minute and a re-export. An accepted-but-reordered file costs you a session of debugging MIDI that was wrong before it arrived, and it will pass every check the page runs.

What you see

The refusal message names no format, so it does not tell you what to do.

Each failing file was loaded into the production page through its own file input and converted, to read the exact status line a user gets rather than the exception thrown underneath it. For all four failing containers — AIFF, AIFF-C, CAF, WMA and MP2 across every variant tested — the status is the same five words: Unable to decode audio data. The download button stays hidden and no file is produced.

That string is the browser's own error, passed through unchanged. It does not mention AIFF, does not suggest a format that would work, and does not distinguish "this container is not supported" from "this file is damaged". A user who exported AIFF because it is what their DAW defaults to has no way to learn from the page that a WAV export of the identical take would convert immediately — which, given that the two payloads are byte-identical, is the single most useful thing that could be said at that moment.

The three working formats with lossy codecs are worth noting for the opposite reason. AAC in M4A, Opus and Vorbis all returned 60, 64, 67 — the same notes as the lossless source. At 160 kbps AAC and at default Opus bitrates the encoding artefacts were not enough to move a pitch estimate on this material. That is a statement about a clean three-note phrase, not a licence to convert a noisy phone recording and expect the same, and the MP3 page covers what a lossy codec's own delay does to the note grid rather than to the pitches.

What to do

Export WAV or FLAC, and if the result sounds wrong, check the sample format before the playing.

For a file the page refuses, the fix is an export rather than a re-record. Any DAW will write a 16-bit 44.1 kHz WAV from the same session, and this page has measured that container at every depth and rate it was given without a single changed note. FLAC is equally safe and about a seventh of the size on this material — 33,759 B against 228,482 B for the same audio. A command-line conversion is enough: ffmpeg -i input.aiff -c:a pcm_s16le output.wav.

For a file that converts but comes back wrong, the useful first check is the level, not the notes. A byte-order or format mismatch shows up as a buffer pinned at full scale: peak near 1.0 and RMS several times what the take should be. Looking at the waveform in any editor settles it in seconds, and if the peaks are flat-topped against the ceiling on material you know was not recorded hot, the samples were misread before the converter ever saw them.

Two behaviours to expect either way. The converter will not report a dropped note — if a phrase returns fewer notes than were played, the absent ones simply are not in the file, which is the gate described on the missing-notes page. And a phrase that decodes to fewer than three notes is refused outright rather than downloaded, so a container problem on a short file can look identical to a phrase the detector could not follow.

Limits

What this test does not cover

The limit of this test. Seventeen containers is not every container. ALAC, WavPack, APE, DSD, MP3 at other bitrates, multichannel WAV beyond stereo, and 32-bit integer WAV were all left untested, so the table describes a sample rather than an exhaustive list. The four refusals are specific to the browser that ran them — headless Chrome 158 on Windows. Firefox and Safari ship different decoder sets, and Safari in particular has historically handled AIFF, so a Mac user on Safari may see a different table. Nothing here was run in those browsers.

The source signal is synthetic and clean: five harmonics, no noise, no room, 0.45 s notes with 0.18 s gaps. That is what makes the "same three notes every time" result readable, and it is also why it does not generalise to lossy codecs on real material. A 160 kbps AAC of a noisy room recording was not tested and would not be expected to preserve pitches as cleanly.

The byte-swap case was constructed deliberately rather than captured from a real broken file. It demonstrates what the failure looks like and what it costs; it does not establish how common the mistake is in the wild. The payload comparison between the AIFF and the WAV used one file pair, so "byte-identical modulo endianness" is a measurement of that pair, not a claim about every AIFF ever written.

Finally, the 8 kHz result above is true only because this phrase contains no content near the band edge. Nothing here should be read as "low sample rates are safe" — that question is measured separately on the sample-rate page, where the same detector on the same machine loses notes at the bottom of its range depending on the device rate.

Questions

Formats and this converter

Why does my AIFF file say "Unable to decode audio data"?

Because the browser's decoder has no AIFF support in the build that ran this test, so no sample buffer is produced and the note detector is never called. Measured across seven AIFF variants — 16 and 24-bit, 44.1 and 48 kHz, mono and stereo, .aif, AIFF-C, and a hand-written container — all were refused with the same message. Exporting the same take as WAV converts immediately, because the sample payload inside the two files is byte-identical apart from its endianness.

Can I just rename the file to .wav?

No. The decoder reads the leading bytes, not the extension. Measured both directions: a WAV renamed to .aiff decoded normally and returned C4 E4 G4, and an AIFF renamed to .wav still failed. A rename cannot break a valid file and cannot repair an invalid one, so it is never the fix.

Does a higher bit depth or sample rate convert better?

Not on this material. 8-bit, 16-bit, 24-bit and 32-bit float all returned MIDI 60, 64, 67 at the same start times, and so did files stored at 8 kHz, 44.1 kHz and 96 kHz — the browser resamples everything to its own 44,100 Hz context before the detector runs. Sample rate stops being irrelevant only when the file's band edge cuts into the content, which is measured separately.

Is WMA supported? And CAF, and MP2?

All three failed to decode in the browser used for these measurements, as did every AIFF variant. That is four containers refused out of seventeen tested, while thirteen decoded with identical results. WMA and CAF are both listed as audio/ types, so the file picker will let you select them and the failure appears only after you press Convert.

My file converted but the notes are wrong. Is that a format problem?

Possibly, and it is worth ruling out first. A WAV whose sample bytes are in the wrong order decodes without error but returns 48, 64, 55 for a phrase that is 60, 64, 67 — two wrong notes, one of them an octave off — while reporting a successful conversion. The tell is the level: peak reads 1.000 and RMS 0.429 against 0.208 and 0.079 for the correct file, so the buffer is pinned at full scale. If your waveform looks flat-topped on material recorded quietly, the samples were misread before conversion.

Does an MP3 or M4A lose notes compared with WAV?

Not here. AAC at 160 kbps, Opus and Vorbis all returned exactly 60, 64, 67 on the same source phrase, matching the lossless WAV. That is a clean synthetic three-note signal, so it says the pitches survived these bitrates and nothing more. A lossy codec's timing offset is a separate matter and is the subject of the MP3 measurement, which is about where notes land rather than which pitches are found.

What is the smallest file that still converts reliably?

Format does not change that answer, but note count does. The converter refuses to write a file when fewer than three notes are detected, so a short phrase in an unsupported container and a short phrase the detector could not follow produce the same empty outcome. Get the container right first, then judge whether the phrase itself was long and clear enough.

Related readings

The sample-rate page takes the decoder's output as its starting point and measures how the device rate shifts the band the detector can report. The missing-notes page covers the notes that are decoded but never written. The MP3 page measures the codec delay that survives decoding and moves the whole note grid. The privacy page documents that this decoding happens in the tab, which is why the browser — and not a server — decides which containers work.

Reproduction: node run-codec-formats-1204.js regenerates the matrix, the AIFF groups and the byte-swap pair, and prints the detector's sha256 in its last lines (77a9dd6b, 8,069 B). The detector is read out of the production converter.js by detector-from-live.js rather than re-implemented, so these numbers move when the shipped detector moves. Live-page status strings were captured by node probe-live-formats-1204.js. Raw output: localmidi-private/logs/codec-formats-2026-12-04.json.