Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #190. Consumers of raw
note,onset, andcontourarrays can now map frames to original-audio sample positions without accumulating error at input-window boundaries. Add the opt-inmodel_frames_to_samples()utility and document its use inunwrap_output,run_inference, and the README.This follows the same request as #199, which was closed by its author without merge. The helper accounts for input padding, supports custom hops and odd overlaps, and keeps the existing inference arrays and decoded MIDI behavior intact. It describes the raw frame grid, separately from the empirical alignment correction used for decoded note events.
Evidence
Before: On a synthetic 530-second window grid, uniform
frame_index * FFT_HOPindexing differs from window-derived sample positions by up to 60,724 samples (about 2.75 seconds).After: The helper matches those positions exactly, with zero sample-position error.
23 tests passed on Windows / Python 3.12.14 with the bundled ONNX model and ONNX Runtime 1.20.1:
This includes 13 new timing cases, existing prediction/note-event reference comparisons, and MIDI/WAV/CSV/NPZ export. The timing cases exercise real input-window generation and unwrapping, including zero overlap, odd overlap, custom hops, empty output, invalid parameters, and a long recording's window grid.
Black (120-column limit), Flake8, and
git diff --checkpass for the changed files. TensorFlow training and dataset suites were not run locally.Merge Danger
Door: Two-way. The helper, documentation, and tests can be reverted independently.
Blast Radius: API. Adds an opt-in function; existing prediction values, note decoding, and MIDI output are unchanged. Callers using custom overlap/hop settings must pass those same settings to the helper. Sample positions use the resampled 22,050 Hz audio grid and are not clipped to audio duration.