AUDIO TO MIDI / CONSTANT SAMPLE OFFSET

Audio to MIDI for a recording with DC offset

A shifted baseline can change the returned note draft.

Measured answer. Our six-note clean control produced six MIDI events. Adding 4096 to every saved sample produced seven, including an extra E5 that continues into the constant-valued tail. Some of the first six notes also changed timing. This is one synthetic file pair and export setting, not a hardware diagnosis or proof that offset removal will repair another recording.

21 November 2026 · Original saved PCM · Actual native MIDI downloads.

One saved melody, shifted by one constant

We reuse the exact original six-tone source from our earlier sample checks. Its intended keys are 60, 62, 64, 65, 67 and 69: C4, D4, E4, F4, G4 and A4 here. Programmed starts are 0, 0.5, 1, 1.5, 2 and 2.5 seconds. Each tone window lasts 0.36 seconds, including a 0.01-second attack and a 0.06-second release. The original synthesis uses a 0.25 amplitude coefficient before signed PCM16 rounding; samples outside those windows are zero.

Both files are mono PCM16 at 22,050 samples per second. Each contains 77,175 samples, so duration = 77,175 ÷ 22,050 = 3.5 seconds; each complete WAV has 154,394 bytes. The offset version uses offset[i] = original_saved_clean[i] + 4096. This addition applies to every stored frame, including the gaps and final tail. It neither rescales the tone nor moves its programmed windows.

A separate saved-file reader verified all 77,175 integer differences. The clean range is −8192 to 8192; the offset range is −4096 to 12288. Neither offset extreme reaches a signed PCM16 rail. The clean sample sum is −2611 and the offset sum is 316,106,189, so the mean change is (316,106,189 − (−2611)) ÷ 77,175 = 4096. We do not assume that the finite original sample mean was exactly zero.

The same saved clean waveform and its constant-offset version, plotted at the same frames and scale against each row's zero baseline.
Actual saved frames 2205 through 2645. A shifted baseline is different from multiplying every sample or flattening its peaks.

Hear the original input files

These players use the saved WAVs, not audio rendered from the returned MIDI. Playback begins only when you choose play. Listening is separate from checking the exact samples and saved note events; we did not run a listening panel or measure a playback device's response to DC.

Original clean melody

The exact saved original, including zero-valued gaps.

Constant-offset melody

Every saved sample plus 4096, including all gaps.

Six intended keys, seven returned events

Saved input tail

4096

One constant integer sample value from 2.86 to 3.5 seconds. Adjacent saved samples differ by zero.

Actual extra MIDI event

E5

Key 76, starting at 2742 ticks and ending at 3277 ticks. No seventh key was programmed in the source.

On 21 November 2026 we separately selected the two originals in production Chrome, using export BPM 120 and the clear-final-release estimate enabled. Selecting the offset file cleared the earlier download before conversion. We clicked each native Download .mid link and independently parsed the newly saved complete files.

The clean export is 101 bytes and contains keys 60, 62, 64, 65, 67 and 69. The offset export is 110 bytes and contains those six keys followed by key 76, E5. Both are format-zero Standard MIDI Files with one track, 480 ticks per quarter note and one tempo event of 500,000 microseconds per quarter note. All note velocities are 88; neither file has controller or Pitch Bend events. Their full bytes differ.

Actual independently parsed note boundaries, in ticks. The last offset event has no paired clean event or intended seventh key.
Key Clean start Offset start Clean end Offset end
C4 / 60 0 0 357 357
D4 / 62 379 401 847 825
E4 / 64 869 892 1315 1315
F4 / 65 1337 1360 1806 1783
G4 / 67 1828 1850 2274 2274
A4 / 69 2296 2318 2691 2742
E5 / 76 No source key 2742 No paired event 3277

The first six keys remain in source order, so we pair only those six. Their start changes, offset minus clean, are 0, 22, 23, 23, 22 and 22 ticks. Their end changes are 0, −22, 0, −23, 0 and 51 ticks. We leave E5 unpaired instead of shifting the reference list or assigning it a made-up source onset. Matching the first six pitch names does not establish unchanged timing.

Inspect the source under the extra event

The programmed final A4 window ends at 2.5 + 0.36 = 2.86 seconds. Its corresponding sample boundary is round(2.86 × 22,050) = 63,063. From frame 63,063 through frame 77,174, the clean file has only zeros and the offset file has only 4096. The independent reader checked all 77,175 − 63,063 = 14,112 tail samples: duration = 14,112 ÷ 22,050 = 0.64 seconds. Every adjacent offset-tail difference is zero.

At the exported tempo, seconds = ticks ÷ 480 × 500,000 ÷ 1,000,000 = ticks ÷ 960. The extra E5 runs from 2742 ÷ 960 = 2.85625 seconds to 3277 ÷ 960 ≈ 3.413542 seconds. It starts slightly before the constant-valued tail and continues inside it. That is a comparison of an actual MIDI event with an independently checked saved source interval, not evidence that this tail contains a played E5.

The programmed final A4 window ends at 2.86 seconds. The offset source then has a constant-valued tail until 3.5 seconds. The actual extra E5 event runs from 2.85625 to about 3.413542 seconds.
The same file-relative scale. Source windows include synthesized fades; these are not measured musician releases or captured detector frames.

A sample offset is not a new intended note

The Audacity DC-offset manual describes a waveform's mean displacement from zero. Our addition is a deliberately specified digital example. We did not measure an audio interface, identify a faulty recording chain, remove offset or test a range of offset sizes. This pair cannot establish that every real recording with DC offset will produce an extra note.

We also did not capture decoding, resampling, gating or pitch-estimation intermediates. Those stages were not measured separately, so this saved input/output comparison does not isolate one internal stage as the cause. The 4096 constant is an experiment parameter, not a recommended recording level or a predicted converter threshold.

Before arranging a MIDI draft, compare its complete event count, keys, starts and ends with the original. If you edit a recording first, keep the original and check both outputs rather than assuming the edit improved transcription. This is an editing recommendation, not a tested repair workflow here. Our conversion tutorial covers selecting and saving a file; hard limiting and additive noise are separate sample operations.

Watch the constant-offset check

Compare the saved shifted waveform with the actual extra E5. The original files and complete timing record are listed below.

Watch this check on YouTube.

Download the original pair and actual MIDI

Original clean melody

Original WAV and its actual native note export.

Clean melody WAV Actual clean MIDI

Constant-offset melody

Original WAV and its actual native note export.

Offset melody WAV Actual offset MIDI

Read saved-sample checks, every actual event, hashes and calculation inputs · Rebuild the offset pair from the clean original.

Questions before accepting the draft

Does an extra MIDI note prove the original tail contained that pitch?

Editorial question. No. Our offset tail has only the value 4096 at every checked saved sample, while the returned E5 extends into that interval. A generated note is an estimate to compare with the source, not an independent measurement of what was played.

Will removing DC offset make every audio-to-MIDI result accurate?

Editorial question. We have not tested that claim. This experiment compares an original synthetic file with a constant-offset version; it does not run an offset-removal workflow or cover real recording hardware. Keep the original, inspect actual outputs and evaluate any edit separately.