feat(sections): label by acoustic repetition, not fixed position#562
Open
seonghobae wants to merge 1 commit into
Open
feat(sections): label by acoustic repetition, not fixed position#562seonghobae wants to merge 1 commit into
seonghobae wants to merge 1 commit into
Conversation
…tion assign_section_labels named segments by position: index 1 was always 'verse', index 2 always 'chorus', regardless of the audio. A song opening intro->chorus got the chorus mislabeled, and two acoustically identical segments could get different labels. Reuse the chroma the boundary detector already computes: take each segment's mean chroma, greedily group segments whose cosine similarity clears a threshold (a repeated section), then name from repetition — most-repeated group is the chorus, other repeats are verses, unique edges are intro/outro, unique middles are bridge. librosa-only, no new dependency. Boundary detection is unchanged. The positional path stays as a fallback when no repetition groups are supplied. New tests assert repeats get a consistent label (an A-B-A-B-A pattern the old positional labeler would have split) and that chroma-level grouping detects repeated vs distinct segments. 100% coverage on the module; full engine suite 439 passed; ruff + mypy clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RjGVapDZ3k7V7zKYk16P4C
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.
What
assign_section_labelsnamed sections by fixed position — index 1 was alwaysverse, index 2 alwayschorus, regardless of the audio. So a song that opens intro→chorus got the chorus mislabeled, and two acoustically identical segments could receive different labels.Now labels come from actual acoustic repetition: reuse the chroma the boundary detector already computes, take each segment's mean chroma, greedily group segments whose cosine similarity clears a threshold (a repeated section), and name from repetition — most-repeated group → chorus, other repeats → verse, unique edges → intro/outro, unique middles → bridge.
Why
Section labels drive the rehearsal roadmap; position-based labels quietly mislabel any song whose form doesn't match the assumed intro/verse/chorus order. Repetition is the actual signal that distinguishes verse/chorus.
Scope / notes
🤖 Generated with Claude Code