AUDIO TO MIDI / POLARITY CHECK

Audio to MIDI for an inverted-polarity melody

Different audio samples can give the same note draft.

Measured answer. Negating every saved mono sample left this pair’s actual MIDI completely unchanged. Both downloads contain the same keys, starts and endings, including the existing timing offsets. Flipping polarity did not repair those offsets. Try the converter for a melody draft, then inspect it against the original audio; this single synthetic pair is not a general robustness guarantee.

27 November 2026 · Exact signed-sample inversion · Actual native MIDI downloads.

Negate the sample, retain its position

We retain a defined mono signed PCM16 control at 22,050 Hz. It has 33,075 sample frames, so duration = 33,075 ÷ 22,050 = 1.5 seconds. The complete WAV has 66,194 bytes: a 44-byte header plus 66,150 audio bytes. Its three source keys are 60, 62 and 64, called C4, D4 and E4 here. Their windows start at frames 0, 11,025 and 22,050, corresponding to 0, 0.5 and 1 second.

Each sounding window occupies 7,938 frames, including its fades: 7,938 ÷ 22,050 = 0.36 seconds. Within a window, gain = min(i ÷ 221, (7937 − i) ÷ 441, 1). The original integer is round(8192 × sin(2π × frequency × i ÷ 22,050) × gain), with ties away from zero. Frequency = 440 × 2^((key − 69) ÷ 12). Outside the three windows the saved value is zero.

The second file retains the same header and sample positions, replacing each signed value x with −x. Its first sample still occupies the first position; later samples are not moved earlier. The saved range is −8192 through 8192 in both files. Neither reaches −32768, so exact signed negation fits this particular PCM16 source without overflow. This construction is polarity inversion, not reversing the time order or changing the sample rate.

Original and inverted saved sample values at the same positions, drawn on opposite sides of a zero baseline.
The chart shows the first 336 saved frames at stride four. The independent reader checks all 33,075 pairs rather than treating this display sample as the complete audit.

Play the actual original inputs

These two players contain the WAVs selected for conversion, not audio rendered from the returned MIDI. They are separated mono files; we do not combine them into a cancellation mix. We did not run a listening study or test physical microphone placement.

Original-polarity control

Inverted-polarity version

Verify the inversion in the saved integers

A separate reader validates the two file hashes, WAV format, RIFF length and data length. It decodes every signed sample. The original integers match an independent rebuild of the stated oscillator and gain formula. At every corresponding position, original[i] + inverted[i] = 0. All absolute values also match exactly, so the changed source signs are verified independently of the converter’s note labels.

Of the 33,075 checked pairs, 9,267 contain two zeros and remain unchanged; 23,808 contain changed nonzero integers. The two counts add to 33,075. Every one of the 9,261 positions outside the defined source windows is zero in both files. The additional zero pairs occur within those windows. Each window contains nonzero samples and begins and ends on zero.

Both complete files have square sum Σ(sample²) = 754,531,703,539. This is a sum of saved integer squares, not a calibrated sound-pressure or loudness measurement. The first 44 header bytes are identical, while the complete WAV hashes differ. A different file hash therefore does not itself tell us whether the returned note instructions will differ.

The reader records positive-going crossings in the steady portion of every window as an additional frequency check. Frequency = 22,050 ÷ ((last crossing − first crossing) ÷ (crossing count − 1)). The raw download retains every crossing position, the formula inputs and the full output events.

The full native MIDI bytes match

On 27 November 2026 we selected each exact original separately in the production Midilot converter in Chrome. Both runs used export BPM 120 with the clear-final-release estimate enabled. After each fresh conversion we clicked the native Download .mid link and independently parsed the complete newly saved file. We also compared every byte, rather than accepting equal file sizes as proof of equality.

Both outputs contain 74 bytes, have the same SHA-256 hash and match in a full byte comparison. The raw record retains both full hashes. Each is format-zero MIDI with one track, 480 ticks per quarter and one tempo event of 500,000 microseconds per quarter. Each contains the same three keys at velocity 88. Its channel events are note-on and note-off, with no controller or Pitch Bend messages.

Actual independently parsed native notes. Tick positions are equal in both complete downloads.
Key Original start Inverted start Original end Inverted end
C4 0 0 379 379
D4 379 379 847 847
E4 869 869 1337 1337

For each key, inverted start minus original start = 0 ticks, and inverted ending minus original ending = 0 ticks. This verifies unchanged saved instructions for the defined pair. We did not capture the converter’s internal processing frames, so these files cannot identify which internal stage is responsible for that invariance.

Both actual native MIDI downloads contain identical C4, D4 and E4 starts and endings, although the input WAV signs differ.
This is a complete file comparison for one defined mono pair. It does not establish an accuracy rate or unchanged output for every possible recording.

Unchanged output leaves the timing limitation unchanged

Using the saved resolution and tempo, seconds = ticks ÷ 480 × 500,000 ÷ 1,000,000 = ticks ÷ 960. D4 begins at 379 ÷ 960 ≈ 0.394792 seconds in both downloads. Its programmed source window begins at 0.5 seconds. Start error = 379 ÷ 960 − 0.5 ≈ −0.105208 seconds, so this returned note starts early in both versions.

Identical bytes preserve that offset as well as the pitch sequence. Flipping source polarity did not create a more faithful timing result in this comparison. Keep the original audio and inspect the returned boundaries in a MIDI editor before arranging a draft. The conversion tutorial covers selecting a file, reviewing notes and saving the result.

Keep the conclusion within the tested pair

The actual exports contain note instructions. Mido’s message reference describes separate note-on, note-off and controller fields; we inspect the complete event content rather than using a waveform impression as a transcription check.

We tested a synthetic mono source and its exact sign inversion at one setting. We did not test a stereo sum, phase cancellation between mixed channels, microphone placement or all other source material. This result does not guarantee polarity-independent transcription for another signal. Reversing the sample order is a different operation; changing the rising envelope is another separately measured source change.

Download the originals and actual MIDI

Original-polarity control

Original WAV Actual native MIDI

Inverted-polarity version

Original WAV Actual native MIDI

Read all saved-pair checks, crossings, events and hashes.

Watch the polarity comparison explained

See the saved sign-inversion check beside both actual native outputs and their unchanged timing limitation.

Original English explanation and diagrams; narration synthesized with macOS Daniel voice. Watch this test on YouTube.

Questions before using this draft

Did polarity inversion fix the early note starts?

Editorial question. No. The complete native outputs are identical. D4 still begins at 379 ÷ 960 ≈ 0.394792 seconds, before its programmed source start at 0.5 seconds. Equal output does not mean accurate timing.

Is this the same as reversing the audio?

Editorial question. No. We replace each signed sample x with −x at its existing position. Reversing the sample order moves samples to different positions. The input check here verifies all corresponding sample sums and the unchanged header.

What changes when two channels are mixed?

Our stereo companion keeps the left channel and varies the right. It records the no-notes result and the measured recovery from a single channel.

Results for matched stereo, opposite stereo and one-channel mono recovery.
See the stereo results and the mono recovery.