AUDIO TO MIDI / SHORT NOTE WINDOWS
Audio to MIDI for a staccato melody
The right pitches can still have the wrong lengths.
Measured answer. Shortening our three source windows preserved all three returned keys and their start ticks, while every returned ending moved earlier. The short-window MIDI still did not reproduce the programmed note lengths exactly. This is one synthetic pair, not a minimum supported note length or an accuracy guarantee.
Change the sounding windows, keep the file duration
We synthesize two mono signed PCM16 inputs at 22,050 Hz. Both contain 33,075 samples, so duration = 33,075 ÷ 22,050 = 1.5 seconds. Each complete WAV has 66,194 bytes: a 44-byte header and 66,150 data bytes. The short-window version contains more zero-valued gaps, not a shorter container or a faster playback rate.
The programmed pitches are keys 60, 62 and 64, called C4, D4 and E4 here. Their source starts are frames 0, 11,025 and 22,050, corresponding to 0, 0.5 and 1 second. Each long window has 7,938 frames: 7,938 ÷ 22,050 = 0.36 seconds. Each short window has 1,985 frames: 1,985 ÷ 22,050 ≈ 0.090023 seconds. We use the exact frame counts in all checks rather than treating the rounded decimal as an exact duration.
Within a window, gain = min(i ÷ 221, (window_frames − 1 − i) ÷ 441, 1). The saved integer is round(8192 × sin(2π × frequency × i ÷ 22,050) × gain), with ties away from zero. Frequency = 440 × 2^((key − 69) ÷ 12). Both controls use this same construction, source starts, peak coefficient and attack/release formula; only the window length argument changes. These are new synthetic controls, not a musician playing two articulations.
Listen to the actual input WAVs
These players contain the originals selected for conversion. They are not sounds rendered from the returned MIDI. Choose play to compare the long and short windows. We did not run a listener study or use a physical instrument recording.
Long-window control
The same three programmed pitches with 7,938-frame windows.
Short-window version
The same starts and pitches with 1,985-frame windows.
Verify what is actually saved in the inputs
A separate file reader checks both headers, data counts and RIFF lengths, then decodes all 33,075 integers in each file. There are 9,261 samples outside the long windows and 27,120 outside the short windows. Every one of those outside values is exactly zero. Each window contains nonzero values, with its first and final sample equal to zero. Both complete inputs have a saved range of −8192 through 8192.
The reader also records positive-going zero crossings inside steady portions of each window. Frequency = 22,050 ÷ ((last crossing − first crossing) ÷ (crossing count − 1)). The raw record retains every crossing position and calculation input. This independent saved-audio check is separate from accepting the source pitch labels or reading a returned MIDI key.
Shortening the windows also changes their total saved energy and the relative proportion occupied by attack and release. For D4, the long-window square sum Σ(sample²) is 251,507,234,130; the short-window sum is 51,750,259,847. We did not normalize their loudness. This comparison therefore does not isolate a universal duration threshold while holding every other signal property fixed.
The keys and starts match; the endings do not
On 25 November 2026 we selected the originals separately in the production Chrome converter. Both used export BPM 120 with the clear-final-release estimate enabled. Selecting the second input hid the previous result. We converted again, clicked each native Download .mid control and independently parsed the newly saved complete files.
The long control produced a 74-byte file and the short control a 75-byte file. Both have three note events, keys 60, 62 and 64, each with velocity 88. Both are format-zero MIDI with one track, 480 ticks per quarter and one tempo event of 500,000 microseconds per quarter note. Neither contains controller or Pitch Bend events. The complete files differ; a larger byte count here is not an extra detected note.
| Key | Long start | Short start | Long end | Short end | End change |
|---|---|---|---|---|---|
| C4 | 0 | 0 | 379 | 111 | -268 |
| D4 | 379 | 379 | 847 | 602 | -245 |
| E4 | 869 | 869 | 1337 | 1070 | -267 |
All three starts are unchanged at 0, 379 and 869 ticks. The C4 ending changes by 111 − 379 = −268 ticks; D4 changes by 602 − 847 = −245; E4 changes by 1070 − 1337 = −267. Each source key occurs once in each actual output, so this pairing does not force an invented match across different note counts.
For short-source D4, the returned interval is (602 − 379) ÷ 960 = 223 ÷ 960 ≈ 0.232292 seconds. The denominator follows from 480 ticks per quarter and 500,000 microseconds per quarter: seconds = ticks ÷ 480 × 500,000 ÷ 1,000,000 = ticks ÷ 960. Its source window is only 1,985 ÷ 22,050 ≈ 0.090023 seconds. Earlier endings do not establish exact articulation recovery.
Inspect intervals rather than accepting the note names
A MIDI file gives note instructions for another instrument. Mido’s message table lists separate note-on and note-off message fields. In this comparison we inspect the paired start and end events, not just a count or a piano-roll label.
We tested two defined window lengths, one synthetic pitch sequence and one export setting. We did not search a range of minimum note lengths, test a real staccato performance or capture internal detector frames. There is no basis here to name an internal stage as the cause of a boundary or promise an accuracy rate for another recording.
Keep the original audio and compare the returned intervals before arranging them in a DAW. The conversion tutorial covers selecting and saving a draft. Repeated occurrences of the same key are a different problem from the different-pitch short windows tested here.
Download the originals and actual native MIDI
Long-window control
Original WAV Actual native MIDIShort-window version
Original WAV Actual native MIDIWatch the short-window test explained
See the programmed windows, saved original checks and the actual returned note endings. This is a defined synthetic articulation comparison, not a physical instrument performance.
Original English explanation and diagrams; narration synthesized with macOS Daniel voice. Watch this test on YouTube.
Questions before using the short-note draft
Did the converter reproduce these staccato lengths exactly?
Editorial question. No. The short-source D4 interval is 223 ÷ 960 ≈ 0.232292 seconds in the saved MIDI, while its defined source window is 1,985 ÷ 22,050 ≈ 0.090023 seconds. Matching the pitch and moving the ending earlier do not make those lengths equal.
Does the 75-byte result contain an extra note?
Editorial question. Not in these actual files. Independent parsing found three keys in each, although the complete files have 74 and 75 bytes. Check the saved events instead of treating byte count as note count or accuracy.
Keep the window, change its rise
Shortening the sounding window changes a different source property from lengthening its rise. Our separate envelope comparison keeps the same window lengths and checks the actual returned starts.