MusicXML import ignores jumps written as `<sound>` attributes
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start with SoundTagMixin.setSound in musicxml/xmlSoundParser.py, which handles only tempo and has TODOs for dacapo, dalsegno, tocoda, fine, segno and coda, then check how the <words> repeat expressions are created in the MusicXML importer. Run the reproduction script in the issue and confirm the expanded note list includes the second D E pass. Done means a <sound dalsegno> jump is honoured without matching text, and the design question of how multiple <sound> tags map to one jump expression is settled first.
索引モデルが issue の本文から書いたものです。
説明
music21 version
10.5.0
Problem summary
The MusicXML importer only creates repeat expressions (Segno, Coda, DalSegnoAlCoda, ...) from the text of <words> directions. It ignores the dacapo, dalsegno, tocoda, fine, segno and coda attributes of <sound>, which are how MusicXML encodes jumps for playback. So when the <words> text isn't one of the recognized phrases, or there's no text, expandRepeats() skips the jump even though the <sound> says exactly what it is.
Steps to reproduce
from music21 import converter
def measure(number, step, before="", after=""):
return (f'<measure number="{number}">{before}<note><pitch><step>{step}</step>'
f'<octave>4</octave></pitch><duration>4</duration><type>whole</type></note>{after}</measure>')
xml = f'''<score-partwise version="4.0">
<part-list><score-part id="P1"><part-name>Music</part-name></score-part></part-list>
<part id="P1">
{measure(1, "C", "<attributes><divisions>1</divisions></attributes>")}
{measure(2, "D", '<direction><direction-type><segno/></direction-type><sound segno="segno"/></direction>')}
{measure(3, "E", after='<direction><direction-type><words>To Coda</words></direction-type><sound tocoda="coda"/></direction>')}
{measure(4, "F", after='<direction><direction-type><words>Repeat from sign, then go to the coda</words></direction-type><sound dalsegno="segno"/></direction>')}
{measure(5, "G", '<direction><direction-type><coda/></direction-type><sound coda="coda"/></direction>')}
</part>
</score-partwise>'''
expanded = converter.parse(xml, format='musicxml').expandRepeats()
print([n.name for n in expanded.flatten().notes])
Expected vs. actual behavior
Expected ['C', 'D', 'E', 'F', 'D', 'E', 'G'], from the dalsegno attribute. Actual:
['C', 'D', 'E', 'F', 'G']
With <words>D.S. al Coda</words> the jump is taken, so this only affects jumps whose text isn't a recognized phrase.
More information
SoundTagMixin.setSound in musicxml/xmlSoundParser.py only handles tempo, and has TODOs for coda, dacapo, dalsegno, fine, segno and tocoda.
A suggestion for how the two sources could combine: if only one of <words> and <sound> gives a jump, use it; if both do and they disagree, prefer <sound>, since it's the playback encoding, and maybe warn.
One complication: music21 represents a jump as a single expression, like DalSegnoAlCoda, but MusicXML spreads it over several <sound>s: dalsegno at the jump, tocoda at the "To Coda", and fine at the Fine. So a <sound dalsegno> on its own only says "D.S.", and telling whether it's "al Coda" or "al Fine" means looking for tocoda or fine elsewhere in the part. For the same reason, <words>D.S. al Coda</words> with <sound dalsegno="segno"/> isn't a disagreement, just a more specific description.
- 主要言語
- Python
- スター
- 2.6k
- フォーク
- 459
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 38
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
cuthbertLab/music21 のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
cuthbertLab/music21#2084 ·
メンテナーはふだん 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 が 12 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
cuthbertLab/music21#2019 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Keyboard braille: extractHeading passes a KeySignature where a TimeSignature is expected (isinstance tested on the container)対応中かも @wolfgang-aura が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
cuthbertLab/music21#1986 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
cuthbertLab/music21 の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
Status: Triaged Type: Enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
canonical/craft-store#448 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
good first issue research size:s skill:numerics sub-issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
SKaiNET-developers/SKaiNET#1372 ·
メンテナーはふだん 1 日以内に返信
-
debt
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
microsoft/vscode-flake8#601 ·
メンテナーはふだん 1 日以内に返信