chordSymbolFigureFromChord fails to identify RomanNumeral with sus4 or 7sus4 figures (missing 5th)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start with the reproduction in the issue, which calls chordSymbolFigureFromChord on a RomanNumeral built from II7sus4. The compare() helper and CHORD_TYPES in music21/harmony.py decide whether a pitch set without the fifth matches the 7sus templates, and _parseFigure in music21/roman.py shows how the shorthand is expanded. Done means the repro returns a G#7sus-style figure, with the tests in the harmony module still passing; whether a missing fifth should be allowed is a maintainer decision to check first.
索引モデルが issue の本文から書いたものです。
説明
music21 version
9.9.1
Operating System(s) checked
macOS, Linux
Problem summary
chordSymbolFigureFromChord() fails to identify RomanNumeral chords constructed with sus4 or 7sus4 figures (e.g., II7sus4). The function returns Chord Symbol Cannot Be Identified.
This happens because the RomanNumeral parser generates figured bass shorthand that omits the perfect 5th (e.g., 7sus4 resolves to intervals [7, 4]). When this incomplete pitch collection is passed to chordSymbolFigureFromChord(), the internal dictionary matching strictly requires the 5th to be present for any standard suspended or dominant suspended chord templates, causing the match to fail.
Steps to reproduce
import music21
# Create a 7sus4 roman numeral
rn = music21.roman.RomanNumeral("II7sus4", "F#")
# Attempt to extract its chord symbol figure
chord_figure = music21.harmony.chordSymbolFigureFromChord(rn)
print(f"Chord figure: {chord_figure}")
print(f"Pitches present: {[p.name for p in rn.pitches]}")
Expected vs. actual behavior
Expected behavior: chordSymbolFigureFromChord should return G#7sus (or similar) recognizing the suspended dominant chord.
Actual behavior:
Chord figure: Chord Symbol Cannot Be Identified
Pitches present: ['G#', 'C#', 'F#']
More information
The issue stems from a combination of how the RomanNumeral sets up pitches and how chordSymbolFigureFromChord evaluates them.
- Omitted Fifth in Figured Bass Resolution: In
music21.roman._parseFigure,expandShortHandis called to expand7sus4to['7', '4']. Because the 5th is not explicit,rn.pitchescorrectly omits the 5th, yielding only the Root, P4, and m7['G#', 'C#', 'F#']. - Strict Root Forcing: Because it is a
RomanNumeral, the root is strictly forced (e.g.<music21.pitch.Pitch G#4>). - Failure in
harmony.py: Inmusic21/harmony.pywithinchordSymbolFigureFromChord, thecompare()helper function iterates throughCHORD_TYPES. The notation string for a standard suspended 7th requires the 5th to be present, and it is not explicitly marked as a permitted omission for this chord type. Because the 5th is missing,comparereturnsFalsefor the7sustemplates, eventually falling back toChord Symbol Cannot Be Identified.
Attempted Workarounds
Manually injecting the perfect 5th into the roman numeral before passing it to the analyzer allows it to match correctly:
rn = music21.roman.RomanNumeral("II7sus4", "F#")
rn.add("D#5") # Explicitly add the missing P5
print(music21.harmony.chordSymbolFigureFromChord(rn))
# Output: 'G#7sus'
- 主要言語
- Python
- スター
- 2.6k
- フォーク
- 459
- 平均マージ
- 1日 7時間
- マージ済み PR(30日)
- 40
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
cuthbertLab/music21 のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
cuthbertLab/music21#2084 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
cuthbertLab/music21#2082 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
cuthbertLab/music21#2074 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
cuthbertLab/music21#2055 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Slur bezier-x/y from start element gets overwritten by stop element's values再び着手できるかも @bingliscodes が 10 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
cuthbertLab/music21#2019 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
cuthbertLab/music21 の issue をすべて見る
似ている issue
-
bot-triaged module: LrScheduler module: optimizer triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
documentation glm5 llm-model
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
vllm-project/vllm-ascend#19062 ·
メンテナーはふだん 1 日以内に返信
-
author-page correction
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
acl-org/acl-anthology#10496 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Issue Type: Bug Report
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
celery/celery#10875 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
SasanLabs/VulnerableApp#836 ·
メンテナーはふだん 1 日以内に返信