Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

MusicXML `<segno/>` in a `<barline>` isn't read, so expandRepeats() fails

オープン
#2,083 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
半日
初心者へのやさしさ
62/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python, xml
領域
data

調査の方向性

The MusicXML importer lives in music21/musicxml, where barline children are parsed; the segno is read for directions but not for <barline>. Start by reproducing with the snippet in the issue and checking what expandRepeats() sees in music21/repeat.py. Done when a segno inside <barline> is attached to the measure so the D.S. expansion gives C, D, E, D, E, with a regression test added beside the existing repeat tests.

索引モデルが issue の本文から書いたものです。

説明

music21 version

10.5.0

Problem summary

MusicXML allows a <segno> (and a <coda>) inside a <barline>, as well as in a direction. The importer doesn't read it from a barline, so a later D.S. has no segno to go to, and expandRepeats() raises.

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", '<barline location="left"><segno/></barline>')}
    {measure(3, "E", after="<direction><direction-type><words>D.S.</words></direction-type></direction>")}
  </part>
</score-partwise>'''

converter.parse(xml, format='musicxml').expandRepeats()

Expected vs. actual behavior

Expected the notes ['C', 'D', 'E', 'D', 'E']. Actual:

music21.repeat.ExpanderException: cannot expand Stream: badly formed repeats or repeat expressions

Writing the same segno as <direction><direction-type><segno/></direction-type></direction> gives the expected result, so only the barline placement is affected.

主要言語
Python
スター
2.6k
フォーク
459
平均マージ
1日 7時間
マージ済み PR(30日)
40

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

cuthbertLab/music21 のほかの issue

cuthbertLab/music21 の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。