AUDIO TO MIDI / RISING ENVELOPES

Audio to MIDI for a slow-attack melody

Later detected starts can still be early.

Measured answer. Our slower rising envelope kept the three returned keys and endings, but D4 and E4 started later in the actual MIDI. Those later starts still preceded their defined source windows. Use the converter for a melody draft, then compare its note boundaries with the audio. This single synthetic pair is not an onset-accuracy guarantee.

26 November 2026 · Defined PCM16 envelopes · Actual native MIDI downloads.

Change the rise, retain the sounding windows

Both original WAVs are mono signed PCM16 at 22,050 Hz, with 33,075 sample frames. Duration = 33,075 ÷ 22,050 = 1.5 seconds. Each complete file has 66,194 bytes: a 44-byte header plus 66,150 audio bytes. The container duration and sample rate stay fixed. The programmed keys are 60, 62 and 64, called C4, D4 and E4 here; source windows begin at frames 0, 11,025 and 22,050, or 0, 0.5 and 1 second.

Every window occupies 7,938 frames, including its fade: 7,938 ÷ 22,050 = 0.36 seconds. Within a window, gain = min(i ÷ attack_frames, (7938 − 1 − i) ÷ 441, 1). The fast control uses attack_frames = 221; the slow version uses 2,205. These divisors correspond to 221 ÷ 22,050 ≈ 0.010023 seconds and 2,205 ÷ 22,050 = 0.1 seconds. This defines the rising multiplier, not a measurement of when a listener or detector first hears the note.

The saved integer is round(8192 × sin(2π × frequency × i ÷ 22,050) × gain), with ties away from zero. Frequency = 440 × 2^((key − 69) ÷ 12). We retain the same starting phase, source pitches, window lengths, release divisor and peak coefficient. Changing the rising gain also changes saved signal energy; it is not an isolated timestamp change or a loudness-normalized comparison.

Fast and slower defined gain envelopes rise within the same sounding window and share the same release.
The drawing describes the programmed gain functions. The raw record separately checks the saved PCM samples; no internal detector envelope was captured.

Hear the originals selected for conversion

Play both saved inputs. The slower version uses the longer rising multiplier while keeping the same three source windows. These are synthetic sine-wave controls, not two performances on a bowed instrument. The players are original audio, not sound rendered from the returned MIDI.

Fast-attack control

The rising gain uses divisor 221 frames.

Slow-attack version

The rising gain uses divisor 2,205 frames.

Check the saved files before comparing outputs

A separate reader verifies both WAV headers, lengths and SHA-256 hashes. It decodes all 33,075 signed integers in each file and rebuilds the stated formula independently. Every saved integer matches that construction. Both files contain 9,261 samples outside their defined windows; all of those values are zero. Each window begins and ends on a zero-valued sample and contains nonzero audio.

The paired input check also compares corresponding samples directly. After the slower rise has reached its plateau, all 17,199 compared suffix pairs match exactly. In the 6,615 compared onset positions, the slower input never has a larger absolute integer value; 6,609 pairs differ. These counts come from reading the saved integers, not from the MIDI note names or a visual impression of the waveform.

Positive-going crossings inside the shared steady portions provide an additional frequency check. Frequency = 22,050 ÷ ((last crossing − first crossing) ÷ (crossing count − 1)). The downloadable record retains the crossing positions and all calculation inputs for each pitch. It also retains square sums, so the energy difference remains visible rather than being hidden behind an unsupported claim that the inputs differ only in perceived attack.

Two returned starts move; the endings stay fixed

On 26 November 2026 we selected each saved original separately in the production Midilot converter in Chrome. Export BPM stayed at 120 and the clear-final-release estimate remained enabled. We converted again for the second input, clicked both native Download .mid controls and independently parsed the complete files saved by Chrome.

Both native files contain 74 bytes, but their full bytes differ. Each has three notes, keys 60, 62 and 64, with velocity 88. Both use MIDI format zero, one track, 480 ticks per quarter and one tempo event of 500,000 microseconds per quarter. The channel events are note-on and note-off; neither file contains a controller or Pitch Bend message. Equal file sizes do not establish equal instructions.

Actual complete native files. Start change = slow start minus fast start, in saved export ticks.
Key Fast start Slow start Start change Fast end Slow end
C4 0 0 +0 379 379
D4 379 401 +22 847 847
E4 869 892 +23 1337 1337

C4 remains at tick 0. D4 moves from 379 to 401: 401 − 379 = 22 ticks. E4 moves from 869 to 892: 892 − 869 = 23 ticks. Each source key occurs exactly once in each actual output, allowing a direct pairing. All three ending ticks remain 379, 847 and 1337.

Using the saved tempo and resolution, seconds = ticks ÷ 480 × 500,000 ÷ 1,000,000 = ticks ÷ 960. The D4 shift is 22 ÷ 960 ≈ 0.022917 seconds. Its slower-input start is 401 ÷ 960 ≈ 0.417708 seconds, still before the programmed source window at 0.5 seconds. E4 starts at 892 ÷ 960 ≈ 0.929167 seconds, still before its source window at 1 second. A relative move in the expected direction is not proof of an accurate absolute boundary.

Actual C4 start unchanged, D4 start later by 22 ticks and E4 later by 23 ticks; the slower D4 start still precedes the programmed source start.
The starts come from actual native downloads. The programmed source windows and returned estimates use different definitions and should be compared explicitly.

Use the result as editable notes, then check timing

Choose your own supported melody recording in the converter, run the estimate and save the MIDI draft. Listen to the original while inspecting starts and endings in a MIDI editor. Our audio conversion tutorial explains the selection and download workflow. Keep the original audio so you can make timing decisions with the sound available.

Mido’s message reference describes separate note-on, note-off and controller message fields. We inspect those saved instructions rather than treating a valid file or a plausible pitch list as sufficient evidence of a faithful transcription.

This experiment uses one defined synthetic pair at one export setting. It does not measure a minimum detectable onset, every possible envelope, a physical bowed performance or an accuracy percentage. We did not capture internal detector frames and cannot name an internal algorithmic stage as the cause of the observed offsets. Shortening source windows is a separate comparison from slowing the rise while retaining their lengths.

Download the originals and actual MIDI

Read every saved-sample check, crossing, event and hash.

Watch the envelope comparison explained

Follow the defined source gain, the independently checked originals and the complete native note starts. This is a synthetic control pair, not a bowed instrument performance.

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

Questions before arranging this draft

Did slowing the attack make the note starts accurate?

Editorial question. Not in this pair. D4 moved later but still started at 401 ÷ 960 ≈ 0.417708 seconds, before the source window at 0.5 seconds. That measured shift is different from recovering the programmed source timing.

Are the two 74-byte MIDI files identical?

Editorial question. No. Both have three keys and the same ending ticks, but the actual D4 and E4 starts differ. Compare full events or hashes rather than treating equal file size as equal content.

A different source change can leave the draft unchanged

Changing the rising gain and negating the saved sample signs are separate operations. Our polarity comparison retains every source position and checks the complete actual MIDI files.

A separate exact mono polarity inversion gives identical actual native MIDI bytes for its defined source pair.
Inspect the opposite sample signs and actual MIDI.