Skip to content

Expose exact sample positions for raw model frames - #199

Open
dissonancehelix wants to merge 3 commits into
spotify:mainfrom
dissonancehelix:agent/expose-frame-sample-positions
Open

Expose exact sample positions for raw model frames#199
dissonancehelix wants to merge 3 commits into
spotify:mainfrom
dissonancehelix:agent/expose-frame-sample-positions

Conversation

@dissonancehelix

@dissonancehelix dissonancehelix commented Aug 4, 2026

Copy link
Copy Markdown

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 #190.

@dissonancehelix dissonancehelix changed the title Agent/expose frame sample positions Expose exact sample positions for raw model frames Aug 4, 2026
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