Piano to MIDI: Octaves, Chords and High Notes
For piano to MIDI, check octave placement, simultaneous notes and unsupported high events separately; this single-note detector can supply a line draft, while two-hand chord transcription needs a polyphonic processing path. Evidence.
2. What the input and MIDI fields mean
Our input is a human acoustic-piano microphone recording from Werner Goebl’s Vienna 4x22 Piano Corpus, paired with its original hardware-recorded performance MIDI rather than synthesized from it. Evidence.
We cut source seconds 2.20–8.20, averaged its two 44,100 Hz signed-16-bit channels, and retained a second copy at half amplitude without normalizing either. Evidence.
The aligned crop contains 31 hardware key events across pitches 54–76, with at most three keys held simultaneously. Evidence.
Key-held intervals exclude pedal-held sound and acoustic decay, so their end times are not a complete annotation of everything audible in the recording. Evidence.
Before inspecting detected pitches, we fixed one audio-minus-MIDI clock offset of −0.63375 seconds from the first sustained 10-millisecond RMS bin above the declared threshold. Evidence.
Eight later onset groups, used only for validation, gave RMS-rise residuals from −2.5 to +28.75 milliseconds without refitting that offset. Evidence.
The baseline exported a format-0, one-track file at 480 ticks per quarter note and 500,000 microseconds per quarter note, with its first note numbered 62 at channel field zero. Evidence.
| First exported note field | Parsed value | Download |
|---|---|---|
| Pitch / velocity | 62 / 54 | Original MIDI bytes |
| Start / duration, seconds | 0.65 / 0.371875 | Independent format/event parse |
3. Control one: exact pitch versus an octave candidate
Balanced mode returned two notes from the 31-event reference, with exported pitches 62 and 40. Evidence.
Neither baseline pitch appears in the crop’s reference pitch set, leaving zero exact-pitch onset matches under the unchanged 150-millisecond rule. Evidence.
Output 62 overlaps reference 74 for 0.195 seconds, an octave-lower candidate covering about 52.44% of that output event. Evidence.
Output 40 overlaps reference 64 for 0.06625 seconds, a two-octave-lower candidate covering about 35.73% of that output event. Evidence.
Those different offsets and partial overlaps do not establish complete harmony recovery or justify one global transpose as a repair for missing chord notes. Evidence.
Recorded input crop · Balanced output MIDI · Aligned input/output pitch-time ledger
4. Control two: sensitivity versus simultaneous notes
The reference reaches three held keys, but the baseline output reaches only one simultaneous note. Evidence.
Cleaner, Balanced and More notes exported zero, two and twelve events respectively from the identical recorded crop. Evidence.
Their measured maximum simultaneous output counts were zero, one and one, so the extra More notes events did not restore simultaneous chord notes in this test. Evidence.
More notes produced only one exact-pitch onset match, compared with zero in the baseline. Evidence.
That lone matched onset is 147.5 milliseconds early, just 2.5 milliseconds inside the chosen tolerance. Evidence.
Its classification is therefore sensitive to the disclosed clock-reference uncertainty and should not be treated as an alignment-independent accuracy result. Evidence.
Halving this same recording’s PCM amplitudes reduced the Balanced output from two events to zero. Evidence.
The unchanged implementation estimates one frequency per eligible frame and changes gates between these settings, rather than selecting a separate polyphonic model. Evidence.
| Identical source / mode | Events | Maximum simultaneous notes | Files |
|---|---|---|---|
| piano-mode1 | 0 | 0 | MIDI · CSV · Piano Roll |
| piano-mode2 | 2 | 1 | MIDI · CSV · Piano Roll |
| piano-mode3 | 12 | 1 | MIDI · CSV · Piano Roll |
| piano-half-gain-mode2 | 0 | 0 | MIDI · CSV · Piano Roll |
5. Control three: high-frame candidates versus high exports
After the production RMS gate, the three modes exposed zero, 28 and 86 autocorrelation frame records respectively. Evidence.
None of those recorded frame candidates had lag seven or eight, or a rounded pitch above the reference maximum of 76. Evidence.
No mode exported a note above 76 in this piano excerpt, so the high-note event seen in the prior guitar experiment did not recur here. Evidence.
An absent high event in this excerpt does not prove that high false events are impossible on piano or identify an acoustic cause for another recording. Evidence.
As a numerical control rather than a new recorded event, 11,025 divided by lags seven and eight gives 1,575 Hz and 1,378.125 Hz, corresponding to MIDI 91.0773 and 88.7656. Evidence.
That one-sample step spans about 2.31174 semitones, versus about 0.60751 semitones between lags 28 and 29. Evidence.
Cleaner trace · Balanced trace · More notes trace · Diagnostic groups and arithmetic · Independent trace checks
6. Acceptance order and a fresh-directory rerun
Keep the original source and clock reference first, inspect exact pitch and partial octave candidates separately, then check simultaneous notes before classifying high events. Evidence.
The independent MIDI reader uses equal integer pitch and the nearest eligible onset within 150 milliseconds, one output per reference assignment, without a duration acceptance condition. Evidence.
A fresh-directory run regenerated 21 deterministic WAV, MIDI, JSON, CSV and SVG outputs with identical SHA256 values. Evidence.
These Piano Rolls plot the reference and parsed output ledgers, rather than implying a DAW import or a listening-based judgment. Evidence.
python crop.py
node convert.mjs
python analyze.py
node trace.mjs
python verify-diagnostics.pySetup, contract and commands · Original microphone WAV · Original hardware performance MIDI · Aligned reference and controller data · Half-amplitude recording · Detector results
7. What this test can establish
This is one six-second excerpt from one player and recording session, with local JavaScript conversion and independent file analysis, not a universal piano accuracy benchmark. Evidence.
The guitar comparison changes performance, room, dynamics, pedal behavior and reference generation as well as instrument, so it cannot isolate all causes by itself. Evidence.
We did not run a competing piano transcriber, test live latency, import into a DAW or conduct a listening study, and cannot rank those untested routes. Evidence.
The official Basic Pitch documentation describes a separate polyphonic approach, which is cited as a possible workflow to evaluate rather than as an output measured here. Evidence.
Source audio and performance MIDI are by Werner Goebl’s Vienna 4x22 Piano Corpus under CC BY 4.0; cropping, mono conversion, amplitude control, measurements and plots are our modifications without implied endorsement. Evidence.
8. Choose the next check
Compare the recorded guitar ledgers with this piano case for the same three variables, while retaining each source’s different reference and recording limits. Evidence.
Use the octave-label control to distinguish renamed notes from changed note numbers, and the sustain example when key release and sounding duration diverge. Evidence.
For a one-note-at-a-time source, the single-note conversion guide leads to this site’s draft workflow; simultaneous chord transcription requires a different processing path. Evidence.