Audio to MIDI with a chord: the note that comes back is arithmetic, not chance.

Play a perfect fifth and this converter returns a note an octave below the root — MIDI 48 for C4 and G4, 50 for D4 and A4, 52 for E4 and B4, 55 for G4 and D5. Four roots, four correct predictions, each one calculated from the interval before the run, not read off the output. A perfect fourth behaves the same way and lands on F2, 87.21 Hz.

The rule behind it: the detector keeps one period per frame, and the period that wins is the one where both notes complete a whole number of cycles together. That period is usually lower than either note you played. Once you know the rule you can predict the wrong note before you convert — and predict which voicings return nothing at all.

Select a single melodic line to create a MIDI draft locally.

The selected audio is decoded in your browser; it is not uploaded to a server.

Measured

Five chords, two timbres, and what actually came back.

Every chord below is 1.5 s of steady sound, both notes starting at the same sample, 44.1 kHz mono, peak normalised to 0.5 (−6.0 dBFS). Clean means pure sine waves with no overtones. Harmonic means five partials at 1/h amplitude with a 5 ms attack and an exponential decay — closer to a played note than a test tone. Sensitivity at Balanced throughout. All five single notes were run first as a baseline and read back correctly: 60, 61, 64, 67, 72.

That a chord collapses to one note at all is already established by the key-by-key measurement on the 88-key piano page. What is measured here is which note, and whether it can be computed from the interval in advance.

ChordNotes inClean sines outHarmonic notes outWhat that means
C4 + C#4
minor 2nd
60, 616161The upper note wins at equal level; drop it 6 dB and the root wins instead.
C4 + E4
major 3rd
60, 646264 broken into six pieces (0.12–0.39 s)Pure sines return D4, a pitch that was never played. With overtones the right pitch arrives, fragmented.
C4 + G4
perfect 5th
60, 674848One note, one octave below the root. Identical in all four variants.
C4 + C5
octave
60, 726060The upper octave is the root's own second partial, so it cannot be separated.
C4 + E4 + G4
triad
60, 64, 676464, twice (0.14 s each)One chord tone survives, and only in fragments.

Across the full set — five chords, two timbres, two level balances, twenty runs — the count is blunt: zero returned both played notes, twelve returned exactly one of them, and eight returned neither. The eight include all four perfect-fifth runs (each returning 48 for a chord containing 60 and 67), two major-third runs (62 on clean sines, 61 with the upper note 6 dB down), and two triad runs that returned nothing at all.

Five chords plotted against pitch: grey dots are the notes played, blue dots are the single note returned, and the fifth drops to C3 Played in grey, returned in blue — harmonic notes, equal level, root C4 C3 · 48 C4 · 60 G4 · 67 C5 · 72 61 62 — D4, never played 48 — one octave below the root 60 64 + minor 2nd + major 3rd + perfect 5th + octave triad Two grey dots are two notes played; one blue dot is everything that came back. The octave chord returns only the root, so 60 is both played and returned.
Five chords against a shared pitch axis. The fifth lands a full octave below the root, the major third on clean sines lands between the two notes, and the triad keeps one chord tone.

Mechanism

The note that comes back is the period where both notes line up.

For each frame the detector takes 1,024 samples, hops forward 256, and compares the frame against itself at every lag from 31 to 512 samples. It keeps the single lag with the highest correlation and converts that lag to a frequency, then to a MIDI number. One frame, one note. There is no second pass that looks for a remaining pitch, so a frame containing two notes cannot emit two notes.

The lag that maximises the comparison is not the louder note's period. It is the shortest lag at which both notes have completed a whole number of cycles, because at that lag both parts of the signal line up with themselves and their contributions add. For a perfect fifth the ratio is 3:2, so two cycles of the root and three of the fifth meet at the same lag — and that lag is twice the root's period, which is one octave below the root.

IntervalNotes inPredicted from the ratioNotes outMatch
C4 + G4, fifth60, 67130.81 Hz = 4848exact
D4 + A4, fifth62, 69146.83 Hz = 5050exact
E4 + B4, fifth64, 71164.81 Hz = 5252exact
G4 + D5, fifth67, 74196.00 Hz = 5555exact
C4 + F4, fourth60, 6587.21 Hz = 4141exact

The middle column was calculated from the interval ratio before each run, not read off the output — the prediction is arithmetic, and it held in five out of five cases with a single note each time, 1.47 s long in a 1.5 s file. In the frame-by-frame dump the fifth locks on one lag for all 255 frames of the chord: no flicker, no ambiguity, no hint that a second note exists.

That gives you a usable rule for the fifth, which is the most common dyad in guitar and piano writing: the output will be the root, one octave lower. Not the fifth, not both. If your MIDI track sounds like a bass line under a chord you played, this is why. The same rule moves with the root, so it is not a C-major accident.

The fourth lands differently only because of where it sits relative to the search range. Its common period is 87.21 Hz, and the longest lag the detector will examine is 512 samples, which is 86.13 Hz. That leaves 1.08 Hz of headroom. Play the same fourth a semitone lower and the common period falls outside the range entirely, so the winning lag jumps to whatever else correlates best — the note you get back changes for reasons unrelated to what you played. This sampling-rate dependency is the same ceiling that moves to 1,411.76 Hz at 48 kHz, which the sample-rate measurements cover separately.

The empty case

One voicing returns nothing: no notes, no error, no file.

C4 + E4 + G4 with the root at full level and the upper two notes 6 dB down returned zero notes, in both timbres — and at Low, Balanced and High for the harmonic version. The conversion completes, the status line reports no clear notes, and there is no MIDI file to download. Nothing in the interface suggests that a chord was played at all.

Repeating the same lag search frame by frame explains the empty result. The winner alternates between two lags: the one belonging to the root-and-fifth alignment (48) and the one belonging to the root alone (60). In the dump the runs last one to seven frames, which is 5.8 to 41 ms, and the shortest note the converter will keep is 55 ms at Low, 75 ms at Balanced, 110 ms at High. Every fragment is below all three thresholds, so every fragment is discarded and the output is empty. Lowering sensitivity does not help, because no run is long enough at any setting.

The frame dump is a reproduction of the same window size, hop, lag range and RMS gate, used to explain the result rather than to produce it. The note counts quoted above come from the shipped converter itself (8,069 bytes, sha256 77a9dd6b9f15af65).

This is the worst failure mode on the page because it is silent. A wrong note is visible in a piano roll within a second; an empty result looks like a dead upload, so the usual next move is to re-encode the file, lower the level, or try another browser — none of which changes the outcome, because the cause is the chord itself.

There is a second gate behind the first. A converter that returns one note for a chord also refuses to write a file at all, because the minimum is three notes: feeding the C4 + G4 fixture into the page above returned the single MIDI 48 and then stopped with “Only a few notes were detected. Try a longer, clearer melody before downloading.” No download, no partial MIDI, no note you could inspect. A held chord is therefore the one input where the tool reports a problem without telling you what it found.

Strummed

A strum is not four notes either: it is one low pitch, split four ways.

Four notes — C4, E4, G4, C5 — each 1.2 s long, entering 45 ms apart, which is roughly a slow downstroke. What came out was four events, all of them MIDI 48: 0.13–0.77 s, 0.78–0.96 s, 0.97–1.11 s, 1.11–1.21 s, with velocities 79, 63, 60 and 58.

Two things are gone here. The chord is gone, because every event carries the same pitch — the octave-below-root alignment again, since G4 is present. And the strum is gone, because the four attack times did not produce four note starts. The single sustained pitch was chopped into four pieces by the segmentation step, and only the first piece begins anywhere near the attacks (0.13 s, which is close to the 135 ms mark where the last string enters). Nothing recovers the individual string entries.

What works

Two arrangements that do return both notes.

The same two pitches, played 0.5 s apart with only 0.1 s of overlap, came back correctly. C4 then E4: two notes, 60 for 0.49 s and 64 for 0.59 s. C4 then G4: 60 for 0.49 s, 67 for 0.49 s — plus a 0.10 s MIDI 48 in the overlap, the same alignment artefact showing up in the only place where the two notes actually sounded together. The phantom is exactly as long as the overlap, which makes it easy to spot and delete.

So the practical rules are narrow and testable. Play one note at a time and the converter is accurate on all five baseline notes tested here, both timbres. Let two notes overlap for even a tenth of a second and the note you get back is decided by the arithmetic of the two periods, not by what you played. If the part genuinely needs simultaneous notes, split the source into separate single-line recordings before converting, or use a tool built for polyphonic input — the trade-off between those routes is covered in the polyphonic workflow, and the wrong-pitch cases that survive even on single notes are collected in wrong notes.

One more thing worth knowing before you conclude the converter is broken on chords: the pitch it returns is stable, not random. Every fifth returned the octave-below-root pitch for the full 1.47 s of the chord, at every level and in both timbres. A stable wrong answer is a different problem from an unstable one, and it is the kind you can predict from the interval before you press convert.

Limits

The limits of this test.

All twenty chord conditions are synthetic. A clean sine pair and a five-partial note with a 5 ms attack and exponential decay are controlled inputs, not a recorded guitar or piano chord. A real instrument adds inharmonicity, string-to-string level differences, body resonance and noise, and those can change which lag wins. The measurements establish what the algorithm does when two periods are present; they do not establish an error rate on recorded chords.

The chords are held for 1.5 s with simultaneous onsets, except the one strummed case described above. Nothing here tests repeated chord changes, arpeggios faster than 0.5 s per note, or chords with more than three notes. Level was varied only by 6 dB on one note; the boundary between "the louder note wins" and "the alignment wins" was not mapped. Everything was measured at 44.1 kHz mono, on the build identified above — a multi-pitch detector would make this page obsolete rather than wrong. Velocity values are reported for completeness but were not the subject of the test; the velocity ceiling has its own measurements.

Reproduction: node run-chords.js regenerates every number above from the shipped converter, and node probe-chord-frames.js regenerates the frame dumps. Both read the live file rather than a copy.

Questions

Chords and this converter

Why did my chord come out as a single note, and why that one?

Because the detector keeps one pitch per analysis frame. The note it keeps is decided by the period where both played notes complete whole cycles together, so it can be worked out from the interval before you convert: a fifth gives the root an octave down, a fourth gives the note a twelfth down, an octave cannot be split at all. All twenty measured chord conditions returned either one note or none.

Why is the returned note an octave below what I played?

A perfect fifth is a 3:2 ratio, so the two notes line up again at twice the root's period. That is 130.81 Hz for a C4 + G4 chord, which reads as MIDI 48, C3. The same arithmetic held on D4 + A4 (50), E4 + B4 (52) and G4 + D5 (55).

Can I convert a guitar chord to MIDI with this?

Not as a chord. A four-note strum entering 45 ms apart returned four events at one pitch, MIDI 48, with the individual attacks lost. Play the part one string at a time, or separate it into single lines first.

Why did the converter return no notes at all?

One measured cause is a chord whose frame-by-frame winner alternates faster than the minimum note length. C4 + E4 + G4 with the root at full level and the upper notes 6 dB down returned zero notes at Low, Balanced and High, because every stable run lasted 5.8–23 ms against a 55–110 ms threshold. The interface reports no clear notes and produces no file; it does not mention that a chord was the reason.

Does a different sample rate change the chord result?

The octave-below-root result for a fifth is arithmetic and does not depend on the sample rate. What does move is the lowest period the detector will search: the lag ceiling converts to 86.13 Hz at 44.1 kHz and to a slightly higher frequency at 48 kHz, which matters for intervals whose alignment pitch sits near that floor, such as the perfect fourth at 87.21 Hz.