Beating

Audio to MIDI with beating: one held note comes back as five.

If two voices sit a hertz or two apart, the note you hear as one long A4 comes out of this converter as a run of separate A4 notes with silence between them. Measured on a two-second tone: a 2 Hz beat turned one note into five, every one of them A4, with the note endings landing on the four points where the beat faded out. The pitch never moves. Only the loudness does.

Select an audio file to create a MIDI draft locally.

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

This failure is easy to misread because the notes that come out are all correct. Nothing is transposed, nothing is a semitone off, and the total length is right. What is wrong is that one note became five, so every note after it in the bar is still in the right place while the part as a whole has acquired four extra attacks. In a DAW that looks like a detection bug. In the audio it is a beat.

Everything below comes from one tone, one detector, one variable. Same 440 Hz carrier, same five partials, same two-second envelope, same 44.1 kHz mono, same peak level. The only change is a second copy of the same tone at a slightly different frequency — which is exactly what two strings, two piano strings on one key, or two players in unison produce.

Measured

Five notes out of one, all at the same pitch.

The catch is how narrow the window is. The same beat produced a single clean note once the two voices were more than about a decibel apart, and once more when they were less than a hertz apart. It is the almost-in-tune case that fails, not the obviously-out-of-tune one.

A single 440 Hz tone returns one note, 1.974 seconds long. Add an identical tone at 442 Hz, at the same level, and the same two seconds of audio return five notes.

One 2-second tone at 440 Hz, plus a second copy at 440 + df Hz at matched level. Note sensitivity Balanced. Detector 77a9dd6b.

Frequency differenceBeat periodNotes returnedPitches
0 Hz (identical)—1A4
0.25 Hz4.00 s1A4
0.5 Hz2.00 s2A4, A4
1 Hz1.00 s3A4, A4, A4
1.5 Hz0.67 s4A4, A4, A4, A4
2 Hz0.50 s5A4 × 5
2.5 Hz0.40 s5A4 × 5
3 Hz0.33 s2A4, A4
4 Hz0.25 s2A4, A4
5 Hz0.20 s1A4
8 Hz0.13 s1A4
12 Hz0.08 s1A4

Two things in that table are worth reading twice. The first is that the count is not monotonic. It climbs from one to five as the beat gets faster, then falls back to one — so a faster beat is not a worse case, it is a different case. The second is that the pitch column is constant. Every row, including the five-note one, says A4. There is no pitch error anywhere in this test to explain the extra notes.

Here is what those five notes look like as events, which is what a piano roll shows you:

The five notes returned from the 2 Hz case. Input: one continuous 2-second A4.

StartEndLengthPitchVelocity
0.000 s0.232 s0.232 sA492
0.250 s0.737 s0.487 sA474
0.749 s1.236 s0.487 sA462
1.248 s1.736 s0.488 sA456
1.747 s1.974 s0.227 sA452

The gaps land at 0.232, 0.737, 1.236 and 1.736 seconds. Successive gaps are 0.505, 0.499 and 0.500 seconds apart, which is the 2 Hz beat period, and the first and last notes are about half-length because they are cut by the start and end of the file rather than by a beat. The velocity column is the other tell: it falls from 92 to 52 across the file, so the five notes are not five equal copies of one note but one decaying envelope broken into five pieces.

Mechanism

Two different things break a note, and neither one is a wrong pitch.

The detector decides every frame in two steps: is this frame loud enough, and if so what period repeats. Beating damages both steps, at different beat rates, and knowing which one you hit tells you what to do about it.

Below about 2.5 Hz, the period search flips. At the bottom of each beat the two copies are nearly out of phase, so the frame contains something close to a half-cycle-inverted version of itself. A delay of half the true period then correlates almost as well as the true period does. Measured on the 2 Hz case, the delay of 50 samples (882 Hz, exactly one octave up) beat the delay of 100 samples (441 Hz) by amounts this small:

Correlation sums at the two competing delays, at the frames where the half-period delay won.

FrameDelay 50 (882 Hz)Delay 100 (441 Hz)Margin
0.232 s2.04822.04790.013%
0.238 s2.09562.03143.160%
0.244 s2.03382.02230.573%
0.737 s0.64380.62882.372%
0.743 s0.62470.62000.746%
1.236 s0.19090.18761.775%

A margin of 0.013% is not a decision, it is a coin landing on its edge. The reason it can happen at all is that the sums are not normalised: the shorter delay is compared over 244 overlapping samples and the longer one over 232, so the short delay collects twelve extra terms for free. On a steady tone the true period still wins comfortably. On the floor of a beat, those twelve terms are enough to hand the frame to the octave.

That octave frame lasts two to six frames — 12 to 35 milliseconds at this frame size — which is shorter than any of the three minimum note lengths the tool offers. So it is never reported as a note. What it does instead is end the note in progress and start a new one afterwards, which is why the output is two notes where there was one. In this test the split is visible; the wrong pitch is not.

Above about 2.5 Hz, the loudness gate does the damage instead. Once the beat is fast enough, the trough of the beat is narrow enough that a whole analysis frame sits in it. The frame's level then falls under the gate, the frame is rejected as silence, and the note closes. Measured at 3 Hz, nine frames out of 341 fall under 0.015 and none of them flips to the octave — a clean, quiet gap. At 2.5 Hz the file shows both: five frames under the gate and three octave frames, which is the crossover between the two mechanisms.

This is the part worth carrying to a real session. The two mechanisms overlap in a band around 2 to 3 Hz, and they are the only two ways a steady pitch can be reported as several notes. If your extra notes are separated by gaps you can hear, it is the gate. If they are separated by a single frame and the count matches the beat you can hear in the file, it is the octave flip.

The narrow part

It only happens when the two voices are within about two decibels.

This is the result that decides whether the failure matters to you, and it is the opposite of what you might expect. Beat depth depends on the level difference between the two voices: two equally loud copies cancel completely at the bottom of the beat, and the more unequal they are the shallower the trough. So the split needs a near-perfect level match, not merely a near-perfect tuning.

2 Hz beat, second voice gain swept while the first is fixed. Balanced sensitivity.

Second voiceNotesPitches
−6.0 dB1A4
−3.1 dB1A4
−1.9 dB1A4
−1.4 dB1A4
−0.9 dB4A4 × 4
0.0 dB5A4 × 5
+0.8 dB5A4 × 5
+1.2 dB1A4
+2.9 dB1A4
+6.0 dB1A4

Sweeping the gain in 0.01 steps puts the window at 0.88 to 1.14 — a band 2.25 dB wide, entirely inside the range where two voices are, to any listener, the same loudness. Outside it, the trough of the beat never gets low enough to do either kind of damage.

Two practical consequences follow. A unison of two instruments is the case most likely to split, because two players at matched level is the normal condition for a unison. A single instrument with two slightly mismatched strings — one guitar string, one piano key — splits only if the two strings happen to be balanced to within that window, which is common on a well-regulated piano and uncommon on a guitar where one string is simply louder.

The all-three-sensitivity comparison is in the table further up, and it is worth noting what it does not fix. The split count changes with sensitivity, from 3 notes at the loosest setting to 2 at the strictest in the 0.5 Hz case, but there is no setting in which the split disappears and the note stays whole. Sensitivity moves the two thresholds that decide which of the two mechanisms you get; it does not remove the beat from the file.

Where it bites

The same beat does not behave the same way in every register.

Beat frequency is an absolute number of hertz, not a musical interval, so the same 2 Hz wobble is a wide interval down low and a narrow one up high. But this detector's frame is a fixed 1,024 samples, so the number of cycles it sees inside one frame changes with register too. The two effects do not cancel, and the result is a window that moves:

Which frequency differences split a note into more than one, by register. Balanced sensitivity.

NoteFrequencyDifferences that split
A2110 Hz0.5 to 8 Hz
A3220 Hz0.5 to 4 Hz
A4440 Hz0.5 to 4 Hz
A5880 Hz2.5 to 3 Hz
A61,760 Hz2.5 to 3 Hz

Low notes split across a much wider range of differences than high ones. The reason is the one from the mechanism section: at 110 Hz the true period is 401 samples, so one frame holds about two and a half cycles and a slow beat has room to swing through a full cancellation inside that frame. At 1,760 Hz the period is 25 samples, so even a fast beat only shifts the phase by a small fraction within one frame, and only a narrow band of rates produces the near-half-cycle alignment that flips the period search.

The sampling-rate page covers a related but separate failure at the bottom of the range, where a note falls under the search's lowest frequency and comes back as a fixed wrong value. That one is about the note's pitch being too low to resolve; this one is about two correct pitches interfering.

Level

A quieter recording breaks differently, and in the same direction.

The gate mechanism means overall level matters too, because the trough of a beat is measured against an absolute threshold rather than a relative one. Turning the whole file down pushes the trough toward that threshold, so a quiet file splits at beat rates that a loud file would survive:

2 Hz beat at matched level, whole file scaled. Balanced sensitivity, gate 0.015. "Last note ends" is where the final surviving note stops.

Peak leveldBFSLowest frame levelNotesLast note ends
0.50−6.00.0155151.974 s
0.35−9.10.0108641.649 s
0.25−12.00.0077641.585 s
0.18−14.90.0055841.521 s
0.12−18.40.0037231.057 s
0.08−21.90.0024820.598 s
0.05−26.00.0015510.128 s

Read the last column rather than the fourth. Turning the file down does not merge the notes back into one; it makes the tail of the file disappear. At 0.05 the single remaining note is 0.128 seconds long and starts at zero — the note was still being split, but by then everything past the first beat trough was under the gate and simply gone. The count falls from five to one because the file is being eaten from the back, not because the beat stopped breaking it.

So level is not a fix here either. It is a second variable that sets both how many notes come out and how much of the recording survives, and turning a file up does not remove the beat, it just moves you into the other mechanism.

The changes that do help are at the source. If two voices are deliberately doubled, make one clearly louder, which narrows the trough below the gate. Or detune one far enough that the beat runs faster than about 6 Hz, which puts you outside the splitting range. The second is the normal studio practice anyway — a doubled part is usually spread wider than a couple of hertz on purpose, because a tight unison sounds thin — and for this tool it also converts better.

Limits

The limits of this test.

Synthetic tones, not instruments. Every number here comes from two copies of a synthesised tone with five partials, a 5 millisecond attack and an exponential decay. A real guitar carries pick noise and body resonance; a real piano has a soundboard and three strings per note rather than two. The mechanism — a trough in level, measured against a fixed gate, plus a period search that can be fooled when the trough is half a cycle deep — is what generalises. The specific beat rates are this signal's.

Both voices share one envelope. The two copies start together and decay together, which is the cleanest possible case for a beat and the least like two players. Two players start within tens of milliseconds of each other and drift; the beat then wanders in rate and depth across the note instead of holding steady. This test does not measure a wandering beat, and the counts above should not be read as a prediction of how many notes a two-player unison will produce.

One pitch at a time. No chord was tested, so nothing here says what happens when a third voice at a different pitch is present, or when the two beating voices are an inner voice of a chord. Chords introduce their own arithmetic, covered separately.

The gate figures are this detector's. 0.015 is where Balanced sits; the other two settings are 0.009 and 0.023. The 2.25 dB width of the level window is a property of this gate and this frame size, not of audio in general, and a tool with a normalised correlation or a relative gate would behave differently at every row of that table.

The octave flip is invisible in the output. The frames that flip to 882 Hz are 12 to 35 milliseconds long, which is shorter than the minimum note length at all three settings, so they never appear as a note. Their only evidence in the MIDI file is the boundary between two notes. If a future version changes the minimum note length, the same frames would start appearing as short A5 notes instead, and the mechanism section above would need re-measuring.

Reproduction: node run-beating.js regenerates every table on this page — the frequency sweep, the two-mechanism split, the delay-margin readings, the level window and its 0.01-step boundaries, the register table and the level table. It prints the detector's sha256 on the first line (77a9dd6b, 8,069 B) and writes a log to localmidi-private/logs/. node run-beating.js --fixture writes the two-second test file used for the browser check. The detector is read directly out of the production converter.js by detector-from-live.js, not re-implemented, so the numbers above move if the shipped detector moves.

Questions

Beating and this converter

Why does one held note come back as several notes?

Because the beat between two almost-identical voices is a dip in loudness, and this detector breaks a note at every dip it cannot see past. At a 2 Hz beat a two-second A4 came back as five A4 notes, with the boundaries 0.50 seconds apart — the beat period.

Are the extra notes at the wrong pitch?

No, and that is what makes it confusing. In every row of the sweep the pitch was A4. The boundaries come from a frame whose period search briefly locked onto the half-period (one octave up), but those frames last 12 to 35 milliseconds, which is under the minimum note length, so they are dropped rather than written. What survives is the split, not the wrong note.

Which beat rates are worst?

On a 440 Hz tone, 1 to 2.5 Hz. At 2 Hz one note became five. Below 0.5 Hz, and above about 6 Hz, the same tone returned a single clean note. The count is not monotonic: it climbs and then collapses, because a slow beat and a fast beat break the note through two different mechanisms.

Does the note sensitivity setting fix it?

It changes the count but never removes the split. At 0.5 Hz the loosest setting returned 3 notes and the two stricter settings returned 2. There is no setting on this page where the output was one note while the input had a beat in the splitting range.

What about two instruments playing in unison?

That is the case most at risk, because two players at matched level is exactly the condition the split needs. The window measured here is 2.25 dB wide around equal loudness, so an unbalanced pair — one instrument clearly louder — came back as one note in every test.

Is this the same as a vibrato problem?

Related but not the same. Vibrato moves the pitch, so the failure there is that the note crosses a semitone boundary and starts a new note. Here the pitch does not move at all; it is the loudness that swings, and the note is broken by the loudness, not by the pitch. A file can have one, the other, or both.

How do I get one note out of a doubled take?

Two options, both at the source. Make one of the two voices clearly louder, which narrows the trough below the gate. Or spread the pair wider than a few hertz so the beat runs faster than about 6 Hz. Neither is a setting in the tool; both are decisions about the recording.

Related readings

This is one of several ways a correct-looking melody comes out wrong. The nearest neighbours are the two note-boundary failures: notes that vanish because two attacks were merged into one, which is the same rule read in the opposite direction, and notes that break up because the pitch itself moved. The clipping test covers what happens when the level problem is at the top of the range instead of the bottom, and DC offset covers a level problem that has nothing to do with the music at all. For the case where the note is broken not by level but by speed — two pitches alternating faster than the minimum note length — the trill page measures the cut-off and what comes back above it.