Skip to content

Form names any AABA arrangement ThirtyTwoBarAABA regardless of section length, and NamedForm.VerseChorus can never be produced #384

Closed

Description

@matt-edmondson

What's wrong

The music-analysis spec defines named-form recognition from the section-letter pattern as follows:

https://github.com/ktsu-dev/Semantics/blob/ea623ae52e34c5297f5d1d157a48b52f4061cc49/docs/superpowers/specs/2026-07-01-music-analysis-aggregate-design.md#L238-L260

ThirtyTwoBarAABA = AABA (with the four sections each ~8 bars) … enum NamedForm { ThirtyTwoBarAABA, TwelveBarBlues, VerseChorus, … }

Semantics.Music/Form.cs implements only part of this:

  1. The AABA bar-length check is missing. RecognizePattern maps the string "AABA" straight to NamedForm.ThirtyTwoBarAABA (Form.cs ~L106-109). It never looks at Section.Bars, although Form.Of has the sections in hand.
    • Four 2-bar sections in an A A B A order are reported as a "32-bar AABA" form, which is 8 bars long.
    • Form.Parse("AABA") has no bar information at all, so it also returns ThirtyTwoBarAABA. The parse-only path should arguably stay as it is, or return a less specific name, but that choice needs to be made on purpose.
  2. NamedForm.VerseChorus can never be produced. It is declared in NamedForm.cs:15, but neither RecognizePattern nor Form.Of returns it. The spec lists it in the enum but never gives it a recognition rule.
    • A consumer that switches over NamedForm gets an arm that can never fire.
    • A verse/chorus song such as Verse, Chorus, Verse, Chorus, Bridge, Chorus (the spec's own example, L232) comes out as Unknown.

(The 12-bar blues half of this spec section, which counts events rather than bars, is already tracked in #317 and is not part of this issue.)

What exists today

  • Semantics.Music/Form.cs: Of builds the letter pattern from IsSameStructure groups; RecognizePattern does a pure string switch.
  • Semantics.Music/Section.cs:26: Section.Bars already exists, derived from Progression.TotalBars, so the data needed for the check is available.
  • Semantics.Test/Music/FormTests.cs: Of_ExtractsAABAPattern_AndNamesThirtyTwoBarForm uses short sections and still expects ThirtyTwoBarAABA.

Acceptance criteria

  • Form.Of returns ThirtyTwoBarAABA only when the pattern is AABA and each of the four sections is about 8 bars long. Pick and document a tolerance; exactly 8 is the simplest choice. Otherwise it falls through to the generic result for that pattern (Unknown).
  • Decide what Form.Parse("AABA") returns when it has no bar data, and document that in the XML docs.
  • VerseChorus either:
    • gets a recognition rule based on SectionType, for example the arrangement alternates sections typed Verse and Chorus with at least two of each, allowing an optional Bridge/Intro/Outro, plus a test; or
    • is removed from NamedForm. That is a breaking change and should be tagged [major].
  • Tests:
    • AABA made of 8-bar sections gives ThirtyTwoBarAABA.
    • AABA made of 2-bar sections gives something other than ThirtyTwoBarAABA.
    • The spec's verse/chorus example gives VerseChorus, if that option is chosen.

Dependencies

None. This can land independently of #317, although both touch Form.Of and could share a PR.

Activity

  1. matt-edmondson commented on Oct 6, 2026

    @matt-edmondson
    ContributorAuthor

    Triage

    • Category: Bug (labelled enhancement). Form.Of misnames short AABA arrangements against the spec, and NamedForm.VerseChorus is an enum value nothing can produce.
    • Priority: Medium. The analysis output is wrong but nothing crashes, and it only affects Semantics.Music form naming.
    • Suggested area / assignment: Semantics.Music, Form.Of / RecognizePattern
    • Duplicates / related: Not a duplicate. A sibling of Form.Of detects a 12-bar blues by counting chord events, not bars: 3 bars of quarter notes match and a real blues with held chords doesn't #317 (open), which covers the 12-bar-blues half of the same spec section. Both change Form.Of, so one PR could take both.
    • Already in progress: No open PR references this issue.
    • Decision needed: Two choices to make up front. Should VerseChorus get a SectionType-based recognition rule, or be removed ([major])? And what should Form.Parse("AABA") return when it has no bar data?

    Recommended next step: Make those two decisions, then add the 8-bar check using Section.Bars. Update Of_ExtractsAABAPattern_AndNamesThirtyTwoBarForm, which currently relies on short sections.


    Generated by Claude Code

  2. matt-edmondson commented on Oct 29, 2026

    @matt-edmondson
    ContributorAuthor

    Fixed by #487 (commit 47dffbb, now on main). The commit cites this issue inline as "(#384)" rather than with a "Fixes" keyword, so GitHub didn't close it. Closing by hand.


    Generated by Claude Code

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

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions