WAV to MIDI:
Is the sample-rate label wrong?
Check the WAV sample-rate label before correcting a MIDI draft whose whole melody seems shifted in pitch and speed. If the label disagrees with the rate used to create its samples, the audio is interpreted on the wrong time scale before note detection. Keep the original and re-export from a known-correct source; do not guess a new label. In our identical-payload test, the correctly labelled A4 produced MIDI 69, while half-rate and double-rate labels produced 57 and 80. This is one possible source error, not a diagnosis for every wrong note.
Same samples. A different clock.
On October 9, 2026, this Windows machine generated one two-second, 440 Hz A4 tone at 44,100 samples per second. We wrote the same 88,200 mono, 16-bit sample frames into three WAVs. Only the declared sample rate and its matching byte-rate field changed. All three audio payloads have the same SHA-256. These are deliberately relabelled files, not correctly resampled copies.
Bars show interpreted file duration, not MIDI event length. Frequency values above follow the rate ratio; detected note numbers below are actual outputs.
| Declared WAV rate | File duration | Detected MIDI pitch | MIDI event length |
|---|---|---|---|
| 44,100 Hz Correct source rate | 2.000 s | 69 · A4 | 1.811 s |
| 22,050 Hz Half-rate label only | 4.000 s | 57 · A3 | 3.808 s |
| 88,200 Hz Double-rate label only | 1.000 s | 80 · G♯5 | 0.789 s |
Swipe the table sideways to see every measurement. With a keyboard, focus the table and use the arrow keys.
Each WAV is 176,444 bytes and each unedited MIDI is 42 bytes. The payload equality matters: there is no different performance or MP3 encoding to explain the change. Our parser uses each file's declared rate, then calls the site's unchanged downsampling, note detection and MIDI writer. A fresh repeat reproduced all six WAV/MIDI hashes.
The double-rate result was MIDI 80, not the exact-octave MIDI 81. A doubled interpretation frequency does not guarantee an exact octave from this detector. The first test's assumption of 81 failed; we retained the actual 80 rather than adjusting the detector to fit the prediction. Nor did the event lengths exactly equal the file durations. This experiment establishes changed input interpretation and changed output, not pitch or timing perfection.
Relabelling is not resampling
For this mono PCM payload, duration is sample frames divided by declared samples per second: 88,200 ÷ 44,100 = 2 seconds; 88,200 ÷ 22,050 = 4; 88,200 ÷ 88,200 = 1. Reading unchanged samples twice as slowly halves their interpreted frequency. Reading them twice as quickly doubles it. This arithmetic explains our controlled construction; it does not identify the true recording rate of an unknown file.
A proper sample-rate conversion computes a new sample sequence for the new rate while aiming to preserve the intended timing and pitch. Merely editing the rate label does not perform that operation. Our three files demonstrate the latter mistake. They do not show that correctly exported 22.05 or 88.2 kHz WAVs necessarily transpose a melody or are unsuitable inputs.
Microsoft's WAVEFORMATEX reference defines the sample-frequency, channel and frame-alignment fields. A decoder's reported rate alone cannot prove a label is correct; compare it with the original recorder, project or known source.
Diagnose before editing every note
- Preserve the source. Keep the original WAV and the first MIDI draft. Work on copies so a rate experiment cannot overwrite the recording.
- Check the WAV before blaming the note file. Compare its reported duration and the apparent pitch/speed with the original performance or a known-good export. A whole-source shift suggests a different investigation from one isolated wrong MIDI note. Listening is a recommended check for your file, not a listening test we performed here.
- Compare the declared rate with an independent source. Inspect the recorder/project settings and export history. A project running at a different rate is not by itself proof of corruption: an application may have resampled correctly. Do not “repair” metadata solely because two displayed rates differ.
- Re-export from the known-correct source when possible. Choose the intended WAV export rate in the audio application and verify the new file's duration and sound. Changing just a header or filename is not conversion. If the original rate is unknown, stop guessing and ask the recording's creator.
- Transcribe a short verified excerpt again. Use the browser converter at the same sensitivity, then compare notes and boundaries. Correcting the source clock does not guarantee that detection itself is accurate.
Should I transpose the MIDI instead?
If the WAV's clock is wrong, transposing MIDI alone does not repair the source's duration or its analysis time scale. Establish the input first and re-run it. If the WAV is correct but only a few note events are wrong, this experiment is not the diagnosis; use the note-and-timing check and repair what the actual recording supports.
Will raising sensitivity fix a wrong rate?
Sensitivity does not rewrite the WAV's rate field. This run kept Balanced fixed and changed the label; we did not test a sensitivity-based repair. For a genuinely quiet note, use the separate quiet-note experiment, not a rate guess.
Download the exact comparison
- Correct 44,100 Hz WAV · Actual MIDI 69 output.
- Same payload, wrong 22,050 Hz label · Actual MIDI 57 output.
- Same payload, wrong 88,200 Hz label · Actual MIDI 80 output.
- Run times, full event values, method and SHA-256 hashes · Reproduction script.
Method and limits
The generated tone has amplitude 0.35 before integer rounding and 8 ms edges. All files contain 88,200 frames, one channel and signed 16-bit integer PCM. We parsed the exact bytes to Float32 arrays, used the header rate in the unchanged downsample function, then ran detectNotes at Balanced and buildMidi. The analysis rate was 11,025 Hz in every case, but the downsampled lengths were 22,050, 44,100 and 11,025 samples. Full production-source SHA-256 and exact unrounded event durations are in the JSON.
In the site project, run node tests/wav-rate-research.mjs in a clean output directory, or use --check to repeat without overwriting the original measurements. The downloadable script is the same reproduction code and expects this site's production source at dist/script.js; it is not a standalone music converter.
The measured table bypasses browser audio decoding and the file picker. MDN documents that Web Audio decoding resamples to the AudioContext rate, so a browser's decoded sample count and detection details need not match this direct-parser experiment. We did not measure listening quality, DAW import, a real instrument, a song, other converters or how often incorrect labels occur.
These two wrong-label fixtures are deliberate error specimens, not recovery instructions. With a correctly labelled source, investigate other causes separately: stereo cancellation, too few windows in a very short WAV, or general source and cleanup choices. Exporting existing MIDI as sound is the opposite direction, covered by MIDI to WAV.