AUDIO TO MIDI / COUNT THE ATTACKS
Audio to MIDI for a repeated-note melody
Check how many separate notes survived, even when every source note has the same pitch.
Measured answer. Each of our two six-C4 recordings returned one long C4 in the actual MIDI download. The pitch survived; the repeated attacks did not remain separate. Count events before accepting the draft. These are synthetic controls under one export setting, not a result for every recording.
Six starts at one key, with two keyed lengths
We created two original format-zero MIDI files. Each has six Note On events at key 60, which Midilot labels C4, all on channel zero with velocity 88. Starts are ticks 0, 480, 960, 1440, 1920 and 2400. The files use 480 ticks per quarter note and a single 500,000-microsecond quarter note. This is an explicit 120-BPM construction, not a measured performance tempo.
The shorter control releases each key after 288 ticks; the longer releases it after 432 ticks. Seconds equal tick ÷ 480 × 500,000 ÷ 1,000,000, or tick ÷ 960. Their keyed lengths are therefore 0.30 and 0.45 seconds. Both start the next note 480 ÷ 960 = 0.50 seconds after the previous start.
The programmed key-off-to-next-key-on intervals are (480 − 288) ÷ 960 = 0.20 seconds and (480 − 432) ÷ 960 = 0.05 seconds. Those are instruction gaps. They do not establish how long the rendered recording is silent. The source files contain 92 and 87 bytes respectively; an independent Ruby parser verified every saved note and tempo event rather than inferring the count from file size.
Shorter keyed notes
- C40.0 s
- C40.5 s
- C41.0 s
- C41.5 s
- C42.0 s
- C42.5 s
Keyed length 288/960 = 0.30 seconds. The actual download has one C4 from zero to 2.803125 seconds.
Longer keyed notes
- C40.0 s
- C40.5 s
- C41.0 s
- C41.5 s
- C42.0 s
- C42.5 s
Keyed length 432/960 = 0.45 seconds. The actual download has one C4 from zero to 2.963542 seconds.
Render the instructions before interpreting a gap
We ran the exact current production audio helper locally in Node, with Soft sine for both files. The public reproduction script reads the original MIDI and writes the WAV inputs. Browser transcription was a later step, using those saved files.
The helper adds a linear release after a key ends, using max(0, 1 − (time − keyed length) ÷ 0.12) during the tail. That expression is a reading of this renderer, not a measured acoustic-instrument decay. Changing keyed length changes the resulting waveform, including release overlap and amplitude, so this pair is not a clean experiment on silence duration alone.
The shorter input contains an exact-zero gap of 80 milliseconds
We independently read the signed PCM samples in both saved WAVs. The shorter file has 72,765 mono samples at 22,050 samples per second, stored as 16-bit PCM in 145,574 bytes. Its duration is 72,765 ÷ 22,050 = 3.30 seconds. The longer file has 76,073 samples and 152,190 bytes, giving 76,073 ÷ 22,050 ≈ 3.450023 seconds. Each includes the renderer's tail allocation.
For each of the five spaces between source keys, we examined the saved samples from ceil(key-end seconds × 22,050) through ceil(next-start seconds × 22,050) − 1. We counted the longest consecutive run whose integer PCM values were exactly zero, preserving every window boundary and run endpoint in the raw record.
All five examined spaces in the shorter input contain a longest exact-zero run of 1,764 samples. The duration is 1,764 ÷ 22,050 = 0.08 seconds, not the 0.20-second key-instruction gap. None of the examined samples in the longer input's five key gaps is exactly zero; its longest zero-run counts are all zero. That is a digital-sample observation, not a measurement of perceived silence.
A sine wave can cross zero during a sounding tone. Counting an isolated zero-valued sample as a quiet interval would confuse those phenomena, so the record retains the consecutive-run length and exact frame positions. The absolute PCM peaks over the complete files are 4,995 and 6,362. Equal MIDI velocity does not make these two rendered waveforms identical.
Both actual downloads contain one event, not six
On 12 November 2026, we separately selected each saved WAV in the production converter in Chrome. Export BPM was 120 and the clear-final-release estimate was enabled. Selecting the longer file cleared the first result before conversion. Each new result showed one C4 note. We clicked both native MIDI links and independently inspected the saved downloads with Ruby.
Each actual file is a 56-byte, format-zero Standard MIDI File with one track, 480 ticks per quarter note and a single 500,000-microsecond tempo event. Each contains one Note On at numeric key 60 and one matching end. It has the expected pitch value, but there are no separate later Note On events for the remaining source repetitions. Under an event-count comparison, actual minus original equals 1 − 6 = −5.
| Source keyed length | Original notes | Actual notes | MIDI bytes | Actual end tick | Actual end (s) |
|---|---|---|---|---|---|
| 288 ticks | 6 × key 60 | 1 × key 60 | 56 | 2691 | 2.803125 |
| 432 ticks | 6 × key 60 | 1 × key 60 | 56 | 2845 | 2.963542 |
Both actual starts are tick zero. The shorter result ends at 2691 ÷ 960 = 2.803125 seconds; the longer ends at 2845 ÷ 960 ≈ 2.963542 seconds. The two files have different end events and hashes despite having the same byte length. A successful download and a valid file structure did not establish a recovered repeated-note rhythm.
We do not calculate a per-note onset error by pairing six source events with one returned event. That would require an extra matching rule and could hide the missing repetitions. The original final keyed ends are ticks 2688 and 2832. Comparing only the two span endpoints gives (2691 − 2688) ÷ 960 = 0.003125 seconds and (2845 − 2832) ÷ 960 ≈ 0.013542 seconds. Close final endpoints do not restore the lost internal attacks.
Why the nominal key gap does not predict a split
The current detector implementation analyzes overlapping frames, smooths pitch labels, forms note segments and then merges adjacent equal pitches when their detected gap is below 0.055 seconds. Its source constants are 1,024 samples per window, a 256-sample hop and an 11,025-Hz analysis rate. The corresponding window and hop durations are 1,024 ÷ 11,025 ≈ 0.092880 seconds and 256 ÷ 11,025 ≈ 0.023220 seconds.
These are implementation values, not captured intermediate frames from our runs. In particular, the merge rule compares detected segments; it does not directly compare the source MIDI's 0.20-second key gap or the stored WAV's 0.08-second zero run. Our first input had that zero run and still produced one note. The two inputs do not isolate which analysis stage caused the final merge, so we do not assign a more specific cause.
Review attacks before arranging the draft
The MIDI Association's message summary distinguishes Note On and Note Off and identifies their key-number fields. A repeated pitch can therefore be represented by several separate note events. Seeing C4 once is different from seeing the expected count of C4 starts.
Keep the source beside the MIDI in your editor. Review the number of attacks and their positions before snapping anything to a beat grid. If one long event spans a repeated passage, use the recording to decide where any splits belong, then review each new boundary. We did not test that manual editing workflow in a DAW here, and it does not automatically repair missing information.
For the general selection and export steps, use the audio-to-MIDI guide. A melody's register jumps and unequal timing between different notes need their own checks; neither substitutes for counting repeated attacks.
Download the original controls and actual exports
These are the exact files used in the recorded runs.
288-tick control
Keep the original instructions, rendered recording and actual export together.
Original 288-tick MIDI Rendered 288-tick WAV Actual 288-tick MIDI432-tick control
Keep the original instructions, rendered recording and actual export together.
Original 432-tick MIDI Rendered 432-tick WAV Actual 432-tick MIDIRead all source events, PCM windows, actual MIDI events, hashes and formulas.
Two questions before accepting repeated notes
Does one correct C4 mean that six repeated notes survived?
Editorial question. No. Both source files contain six separate C4 instructions, while each actual MIDI contains one. Pitch identity, event count and boundary timing are separate checks. The saved files establish a count difference for these controls, not a general accuracy score.
Is a key-instruction gap the same as a silent audio gap?
Editorial question. No. Our shorter control has a programmed 0.20-second key gap, but the stored recording has an exact-zero run of 0.08 seconds in each examined interval. The renderer's release extends beyond key-off. Check the actual samples before labeling an instruction gap as silence.
Scope of this check
These are synthetic single-key sequences with one renderer tone, velocity and Chrome export configuration. Changing key duration changes several aspects of the recording, and the tests do not isolate an analysis-stage cause. We did not test real instruments, voices, other converters or a DAW. The observed files establish the six-to-one event count and endpoint differences for these inputs.