Skip to content

Add scale suggestions for 7(♭9)♯5 chords#35

Merged
twitchax merged 4 commits into
mainfrom
copilot/add-scale-suggestions-for-chords
Jan 23, 2026
Merged

Add scale suggestions for 7(♭9)♯5 chords#35
twitchax merged 4 commits into
mainfrom
copilot/add-scale-suggestions-for-chords

Conversation

Copilot AI commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

Chords with both ♭9 and ♯5 alterations (e.g., C7(♭9)♯5) were incorrectly identified as AugmentedDominant and received scale suggestions (whole tone, lydian dominant) that didn't contain the ♭9 chord tone.

Changes

  • New chord type: Added AugmentedDominantFlat9(Degree) variant to KnownChord enum
  • Scale candidates: Defined three recommendations ranked by relevance:
    • Altered scale (melodic minor mode 7) - contains ♭9, ♯5, ♭5
    • Diminished half-whole - provides ♭9, ♯9, ♯11, 13
    • Phrygian dominant (harmonic minor mode 5) - emphasizes ♭9
  • Chord identification: Updated known_chord() to detect Augmented5 + Flat9 modifier combination before falling back to AugmentedDominant
  • Display: Chord name uses + prefix consistent with other augmented chords (e.g., C+7(♭9))

Example

// Before: Wrong identification and scales
C7b9#5C+7(9) (augmented dominant)Whole tone: C, D, E, F, G, A// Missing D♭ (♭9)!

// After: Correct identification and scales  
C7b9#5C+7(9) (augmented dominant flat 9)Altered: C, D, E, F, G, A, B// Contains all chord tones

The naming follows the existing augmented chord pattern:

  • C+ → augmented
  • C+(maj7) → augmented major 7
  • C+7 → augmented dominant
  • C+7(♭9) → augmented dominant flat 9

Updated all match arms handling KnownChord variants (relative_scale, relative_chord, name, description, scale_interval_candidates).

Original prompt

Can you please add some scale suggestion for 7(♭9)#5 chords?


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 23, 2026 04:41
Co-authored-by: twitchax <549523+twitchax@users.noreply.github.com>
Co-authored-by: twitchax <549523+twitchax@users.noreply.github.com>
Copilot AI changed the title [WIP] Add scale suggestions for 7♭9#5 chords Add scale suggestions for 7(♭9)♯5 chords Jan 23, 2026
Copilot AI requested a review from twitchax January 23, 2026 04:49
@twitchax

Copy link
Copy Markdown
Owner

@copilot, ahhh, sorry. Feel free to call it AugmentedDominantFlat9 to keep it in line with all the other augmented cases.

Co-authored-by: twitchax <549523+twitchax@users.noreply.github.com>

Copilot AI commented Jan 23, 2026

Copy link
Copy Markdown
Contributor Author

@copilot, ahhh, sorry. Feel free to call it AugmentedDominantFlat9 to keep it in line with all the other augmented cases.

Done! Renamed to AugmentedDominantFlat9 in commit 5851a07.

The chord now displays as C+7(♭9) which is consistent with other augmented chords like C+7 (augmented dominant) and C+(maj7) (augmented major 7).

@twitchax twitchax marked this pull request as ready for review January 23, 2026 06:56
Copilot AI review requested due to automatic review settings January 23, 2026 06:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for identifying and providing scale suggestions for augmented dominant chords with a flat 9 alteration (e.g., C7♭9♯5). Previously, these chords were misidentified as regular augmented dominant chords and received scale recommendations that didn't include the ♭9 chord tone.

Changes:

  • Added new AugmentedDominantFlat9(Degree) variant to the KnownChord enum with complete implementation across all trait implementations
  • Defined three ranked scale candidates: Altered scale (rank 1), Diminished Half-Whole (rank 2), and Phrygian Dominant (rank 3)
  • Updated chord identification logic to detect Augmented5 + Flat9 modifier combination before falling back to regular AugmentedDominant

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
kord/src/core/known_chord.rs Added new AugmentedDominantFlat9 enum variant; implemented all required trait methods (HasDescription, HasRelativeScale, HasRelativeChord, HasName); added scale candidates with musical reasoning; added comprehensive test coverage
kord/src/core/chord.rs Updated known_chord() method to detect Augmented5 + Flat9 combination; added defensive check to prevent duplicate (♯5) display in chord names; added test case for new chord type

Comment on lines +362 to +365
Interval::MinorThird,
Interval::MajorThird,
Interval::AugmentedFourth,
Interval::AugmentedFifth,

Copilot AI Jan 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The relative scale for AugmentedDominantFlat9 contains both MinorThird and MajorThird, which is musically inconsistent. The Altered scale (7th mode of melodic minor), which is the primary scale recommendation for this chord, should have intervals: 1, b9, b3 (enharmonic #9), 3 (enharmonic b4), b5, #5 (enharmonic b13), b7. The current relative scale appears to mix intervals from different scale sources rather than consistently representing the Altered scale. Consider aligning these intervals with the Altered mode definition found in mode_kind.rs, which uses DiminishedFourth (enharmonic major 3rd) and MinorSixth (enharmonic augmented 5th) to avoid having both minor and major thirds in the same scale.

Suggested change
Interval::MinorThird,
Interval::MajorThird,
Interval::AugmentedFourth,
Interval::AugmentedFifth,
Interval::MinorThird, // b3 / #9
Interval::DiminishedFourth, // enharmonic major 3rd
Interval::DiminishedFifth, // b5
Interval::MinorSixth, // enharmonic augmented 5th

Copilot uses AI. Check for mistakes.
IntervalCandidate {
kind: IntervalCollectionKind::Scale(ScaleKind::DiminishedHalfWhole),
rank: 2,
reason: "Symmetrical half-whole diminished (dominant diminished) that supports V7(♭9)(♯5); provides ♭9, ♯9, ♯11, and 13 simultaneously; rich dominant tension palette; works well when you need the ♭9 with option to imply or approach the ♯5",

Copilot AI Jan 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DiminishedHalfWhole scale contains a natural 5th (PerfectFifth), not an augmented 5th, which means it doesn't contain the #5 chord tone of the AugmentedDominantFlat9 chord. While the description acknowledges this by saying "option to imply or approach the ♯5", this scale recommendation may be musically questionable for a chord where #5 is a defining characteristic. Consider whether this scale should be included at all, or if the reasoning should more explicitly clarify that this scale omits the #5 chord tone and is better suited for voice leading contexts where the #5 is approached chromatically.

Suggested change
reason: "Symmetrical half-whole diminished (dominant diminished) that supports V7(♭9)(♯5); provides ♭9, ♯9, ♯11, and 13 simultaneously; rich dominant tension palette; works well when you need the ♭9 with option to imply or approach the ♯5",
reason: "Symmetrical half-whole diminished (dominant diminished) providing ♭9, ♯9, ♯11, and 13; note that this scale has a natural 5th, not a ♯5, so it does not literally contain the augmented 5th chord tone. Best used when the V7(♭9)(♯5) is treated with chromatic voice leading, implying or approaching the ♯5 in phrasing rather than sitting on it as a stable scale degree; offers a dense dominant tension palette around the chord tones.",

Copilot uses AI. Check for mistakes.
IntervalCandidate {
kind: IntervalCollectionKind::Mode(ModeKind::PhrygianDominant),
rank: 3,
reason: "Spanish or Phrygian dominant sound (5th mode of harmonic minor) emphasizing the characteristic ♭9; exotic, Middle Eastern, or Flamenco flavor; while it has natural 5th, it can approach or bend toward ♯5 in phrasing; strong V in minor keys",

Copilot AI Jan 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PhrygianDominant mode contains a natural 5th (PerfectFifth), not an augmented 5th, which means it doesn't contain the #5 chord tone of the AugmentedDominantFlat9 chord. While the description acknowledges this by mentioning "it can approach or bend toward ♯5 in phrasing", this scale recommendation may be musically questionable for a chord where #5 is a defining characteristic. The PhrygianDominant mode would be more appropriate for a Dominant(b9) chord without the #5 alteration. Consider removing this recommendation or moving it to a lower rank with a clearer caveat about the missing chord tone.

Suggested change
reason: "Spanish or Phrygian dominant sound (5th mode of harmonic minor) emphasizing the characteristic ♭9; exotic, Middle Eastern, or Flamenco flavor; while it has natural 5th, it can approach or bend toward ♯5 in phrasing; strong V in minor keys",
reason: "Spanish or Phrygian dominant sound (5th mode of harmonic minor) emphasizing the characteristic ♭9 over a natural 5th (no built‑in ♯5 in the scale); best treated as a coloristic option or as if the chord were V7(♭9) without the augmented 5th; avoid leaning on the 5th when the ♯5 is a defining chord tone; strong V sound in minor keys with an exotic, Middle Eastern, or Flamenco flavor",

Copilot uses AI. Check for mistakes.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 62.50000% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.14%. Comparing base (794d4d7) to head (5851a07).

Files with missing lines Patch % Lines
kord/src/core/known_chord.rs 55.55% 12 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #35      +/-   ##
==========================================
- Coverage   81.26%   81.14%   -0.12%     
==========================================
  Files          28       28              
  Lines        5443     5474      +31     
==========================================
+ Hits         4423     4442      +19     
- Misses       1020     1032      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@twitchax twitchax merged commit 2da1025 into main Jan 23, 2026
12 checks passed
@twitchax twitchax deleted the copilot/add-scale-suggestions-for-chords branch January 23, 2026 07:07
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.

4 participants