Audio to MIDI for a Melody With a Strong Second Harmonic
Convert the clip and check the octave against the source. In our matched WAV test, the second harmonic was about three times as strong as the fundamental. Both Chrome downloads kept A3, D4 and E4. Their MIDI events matched exactly.
This result covers one synthetic melody and one converter setting.
Two versions of the same melody
The control uses a sine at the programmed fundamental f. The second take uses 0.25 times that sine plus 0.75 times a sine at 2f. For A3, those frequencies are 220 and 440 Hz. The mixed take still contains the A3 fundamental. In a steady part of the note, the whole waveform repeats after a period of the fundamental.
The monophonic WAVs use the same note windows, fades, sample rate of 22050 Hz and saved PCM16 peak of 8192. Rereading the files verified that the regions between the notes stayed silent. A separate two-sine fit of the steady PCM samples recovered a second-to-fundamental amplitude ratio of about three for each mixed note. The clip RMS values were about 4868 and 4131 on the PCM scale. Equal peaks leave that difference intact. Web Audio reference on harmonic coefficients

Both native MIDI downloads kept the programmed pitches
We selected the two WAVs separately in Chrome, used the 120 BPM export grid and enabled the final-release estimate. Both exports were 74 bytes and matched byte for byte. An independent MIDI reader recovered the same three keys, starts and ends from each. Compare the programmed starts and the recovered values before using the file as a transcription.
| Pitch | Source start (s) | MIDI start (ticks) | MIDI end (ticks) | MIDI start (s) |
|---|---|---|---|---|
| A3 | 0.000 | 0 | 379 | 0.000 |
| D4 | 0.500 | 379 | 847 | 0.395 |
| E4 | 1.000 | 869 | 1337 | 0.905 |

Check timing and pitch separately
In both exports, D4 started at tick 379, or about 0.395 seconds. The programmed D4 began at 0.500 seconds. The strong harmonic produced the same pitch and timing result as the control, including this early start.
The published estimator compares differences between samples over candidate time lags. That is a separate clue from the relative strength of the two sine components. A different instrument, effect or balance could give a different note estimate. If one export sounds an octave high, compare it with the original and try a take with a clearer fundamental before correcting each MIDI note. Published converter script
Watch the second-harmonic experiment
Listen and download the test files
Fundamental alone
Download the original WAVDownload the Chrome MIDIStrong second harmonic
Download the original WAVDownload the Chrome MIDIQuestions about a strong second harmonic
Can the brightest component be an octave above the intended note?
Editorial question. Yes. The second harmonic is at twice the fundamental frequency. In this test it had the larger amplitude, and the complete waveform still contained the fundamental. Both MIDI exports kept the programmed octave.
Should I raise the level to fix an octave error?
Editorial question. A uniform level change keeps the ratio of the two components. Try isolating the melody or comparing with a cleaner take, then check pitch and timing in the MIDI editor.
What if the recording has a click?
Hear a controlled click in the rest between the first two notes of the same programmed melody.
