Change a setting after converting and the file you download is the old one. I ran the four controls one at a time against the live converter and compared the bytes.
Short answer: the four settings are read when you click
Convert to MIDI, not when you click Download .mid. Convert once,
then move any control, and Download still hands you the file built from that earlier click. I
converted one 4-second file, changed each setting in turn and downloaded without re-converting:
all four downloads came back as the same 105 bytes with the same MD5
(4c69bd4e64dc5eb28caaebec7641aa24). Pressing Convert first changed the file in
three of those four cases. Copy note list is the one exception -
it re-reads Transpose when you click it, so the text and the file can disagree. And the page never
tells you: pressing Download replaces the conversion message with a green Saved ...
line, so the last thing on screen says success.
Everything below was measured on this page's own converter running in a real browser at
easyaudiotomidi.com. Real files were pushed into the file input, real mouse events were
sent to the real Convert, Copy and Download buttons, and the page's own outputs were captured: the
text it passed to the clipboard, the bytes it handed to the download, the status line with its colour
class, and the four readouts. Where a number comes from the page's source rather than from a run, it
says so.
All three handlers are short, and the difference between them is the whole story. First, Convert. Every control is read inside the conversion, and the results are stored:
// inside convert(), after decoding
var threshold = 1 - parseFloat(sensEl.value); // Confidence
var minMs = parseInt(minmsEl.value, 10) || 0;
var notes = framesToNotes(mono, TARGET_RATE, threshold, minMs);
var transpose = parseInt(transEl.value, 10) || 0;
var bpm = parseInt(bpmEl.value, 10) || 120;
lastNotes = notes;
var midi = buildMidi(notes, bpm, transpose);
lastMidiBlob = new Blob([midi], { type: 'audio/midi' });
Then Download. It reads no control at all. It reuses the stored blob, takes the file name from the last file you loaded, and then overwrites the status line:
btnDownload.addEventListener('click', function () {
if (!lastMidiBlob) { return; }
var base = currentName.replace(/\.[^.]+$/, '') || 'audio';
var url = URL.createObjectURL(lastMidiBlob);
var a = document.createElement('a');
a.href = url;
a.download = base + '.mid';
document.body.appendChild(a);
a.click();
a.remove();
setTimeout(function () { URL.revokeObjectURL(url); }, 1000);
setStatus('Saved ' + base + '.mid to your downloads.', 'ok');
});
And Copy, which is the odd one out. It reads Transpose at the moment of the click - and only Transpose:
btnCopy.addEventListener('click', function () {
if (!lastNotes.length) { return; }
var transpose = parseInt(transEl.value, 10) || 0;
var text = noteListText(lastNotes, transpose);
...
});
So the page has three different freshness rules, not one. That is the source of every surprise in this article.
One 4-second test file (an 8-note scale, C4 to C5) was converted with every control at its default:
Tempo 120, Confidence 0.85, Transpose 0, Shortest note 60. The conversion reported 8 notes,
C4 - C5, and produced a 105-byte .mid. The copied note list was
294 bytes across 9 lines, MD5 407ccb3701358c3906e1f179db0679f9.
Then, for each control in turn, I reset everything to the default, converted again, moved that one control without pressing Convert, and pressed Copy and then Download with real mouse events. Finally I pressed Convert and captured the same outputs again, so that every row has a "what the page would have given you" comparison next to "what it actually gave you".
| Control moved after converting | Copied text changed? | Downloaded .mid changed? | Readouts changed? | Would Convert have changed the .mid? |
|---|---|---|---|---|
| Tempo 120 to 300 | no | no | no | yes, 2ed25dfd... |
| Confidence 0.85 to 0.50 | no | no | no | yes, 0fcb90dd... |
| Transpose 0 to +12 | yes | no | no | yes, 1bd5932c... |
| Shortest note 60 to 400 | no | no | no | no, identical |
Read the third column across: no, no, no, no. All four downloads were the same 105 bytes and the same MD5 hash, which is the file from the original conversion. Whatever you moved, Download handed back the old file.
The last column is what makes that a bug rather than a design choice. For Tempo, Confidence and Transpose the setting you moved would have changed the file - pressing Convert produced different bytes in all three cases. Shortest note is the only one where the row ends in a tie, and that is a property of this particular file: its shortest note lasts 0.432 s, which is already longer than the 400 ms threshold, so raising the threshold could not remove anything. On a file with short notes the same change is dramatic, as the next section shows.
One readout is not evidence of anything. The Analysis time figure moved
between 0.1 s and 0.3 s across runs that were otherwise identical, so I excluded it from the
"readouts changed" column. Notes found, Duration and Pitch range never moved after a control change
in any of the four runs.
Pulling the source and the measurements together, this is what each part of the page actually listens to:
| What you look at or click | When it reads the controls |
|---|---|
| Notes found / Duration / Pitch range | Only during Convert. Moving a control does not touch them. |
| Piano roll preview | Only during Convert. It is a picture of the notes from that run. |
| Download .mid | Never. It reuses the stored file. Only the file name is read live, and it comes from the last file you loaded, not from a control. |
| Copy note list | Transpose only, at the moment you click. Every other column is from the stored notes. |
| Status line | Rewritten by Convert, by Copy and by Download. Download's message is always green. |
The Copy row is why text and file can describe different music. That behaviour, taken apart byte by byte, is in what the copied note list actually contains, and the full behaviour of each control when you do press Convert is in what each control changes.
This is the part that will cost you a bad file if you are not watching. The status line is the only summary the page gives you, and after a conversion it is a green success message with a note count in it. Moving a control leaves that message untouched, and pressing Download replaces it with another green message. Neither of them is re-checked against the settings on screen.
I used a 3-second test file made of notes of different lengths (20, 40, 60, 80, 100, 160, 320 and 640 ms, separated by silence). At the default Shortest note of 60 ms it converts to 6 notes. Here is the same file with Shortest note raised to 1000 ms - first without re-converting, then with:
| Step | What the page says | File you get |
|---|---|---|
| Converted at the default 60 ms | green: Converted 6 note(s) from 3.0 s of audio in 0.1 s. Range A4 - A4. |
90 bytes |
| Shortest note set to 1000 ms, no Convert | still green, same sentence, unchanged | - |
| Then Download | green: Saved D1.mid to your downloads. |
90 bytes, the old 6-note file |
| Then Convert | red: Decoded 3.0 s of audio, but no steady pitch was found. |
33 bytes, zero notes |
The last two rows are the same settings. Without a re-conversion the page told me, in green, that it
had 6 notes and saved a file - and that file was a real 6-note MIDI file. One click later the same
settings produced a red failure and a 33-byte file containing no notes at all. The 90-byte file has
MD5 67dbe6e84e7719a86b2b733afe6fd8b2; the 33-byte one is
6281fae2ae4d48a4a53e1e6cd062fa70.
A gentler version of the same thing: raising Shortest note to 400 ms on that file gave me a stale
90-byte file claiming 6 notes, where a real conversion gives 1 note and 43 bytes. And with a
different test file - a 2-second tone whose fundamental is deliberately weaker than its second
harmonic - moving Confidence from 0.85 down to 0.50 without re-converting left the readout saying
A3 - A3 and handed me a 42-byte file at 8680179f..., while the real
conversion of those settings reported A4 - A4 and wrote a different 42-byte file at
5f668c94.... Same length, same note count, one octave apart. Why a looser confidence can
flip the octave like that is measured in
the control breakdown.
Ready: M1.wav. Press Convert to MIDI., and no file was produced.Notes found and
Pitch range are the only on-screen numbers that tell you which conversion you are
holding. If they do not match what the current settings should give you, you are holding an older
one.easyaudiotomidi.com.navigator.clipboard.writeText, and the .mid bytes are the blob it
passed to URL.createObjectURL when the download anchor was clicked. The download
itself was blocked so nothing was written to disk.