Skip to content

Expose exact sample positions for raw model frames - #1

Open
dissonance-git wants to merge 3 commits into
mainfrom
agent/expose-frame-sample-positions
Open

Expose exact sample positions for raw model frames#1
dissonance-git wants to merge 3 commits into
mainfrom
agent/expose-frame-sample-positions

Conversation

@dissonance-git

Copy link
Copy Markdown
Owner

What changed

  • Add model_output_frame_samples() to map unwrapped raw model frames back to their original-audio sample positions.
  • Account for the mismatch between the input-window hop and the span represented by each retained output block.
  • Validate overlap and hop arguments.
  • Add deterministic tests covering the first window boundary and invalid alignment inputs.

Why

After overlapping output frames are removed, unwrap_output() concatenates the retained blocks. Treating the global frame index as index * FFT_HOP accumulates timing error because the default input hop is 36,164 samples while 142 retained frames span 36,352 samples.

For retained frame j in input window w, the exact original-audio position is:

w * hop_size + j * FFT_HOP

This does not alter inference arrays, note decoding, or MIDI output. It provides an opt-in alignment utility for consumers of raw note, onset, and contour arrays.

Prepared for upstream issue spotify#190.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant