MusicXML import drops piano-family MIDI programs when the instrument name isn't recognized
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
Lỗi nằm ở phần xử lý score-part của MeasureParser trong musicxml/xmlToM21.py, nơi thay thế nhóm piano làm mất midiProgram khi tên nhạc cụ không được nhận dạng. Chạy script tái hiện trong issue để thấy Instrument có midiProgram là None với chương trình 1 và 2. Hoàn thành khi chương trình 1 và 2 giữ midiProgram lần lượt là 0 và 1, và chương trình 41 vẫn trả về Violin với giá trị 40. Chọn một cách sửa: hoặc chỉ thay thế khi tên được nhận dạng, hoặc sao chép i.midiProgram sang phần thay thế, rồi thêm một test hồi quy cạnh các test phân tích MusicXML hiện có.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
music21 version
10.5.0
Problem summary
When a part's <midi-program> is one music21 maps to Piano (MusicXML programs 1–6), the importer replaces that instrument with the one made from <instrument-name>. That makes sense when the name is recognized, since exporters often write piano as a default program. But when the name isn't recognized, the replacement is a plain Instrument with no midiProgram, so the program is lost. Other programs are kept.
Steps to reproduce
from music21 import converter, instrument
def score(midi_program):
return f'''<score-partwise version="4.0">
<part-list><score-part id="P1"><part-name>Music</part-name>
<score-instrument id="P1-I1"><instrument-name>Doubler</instrument-name></score-instrument>
<midi-instrument id="P1-I1"><midi-program>{midi_program}</midi-program></midi-instrument>
</score-part></part-list>
<part id="P1"><measure number="1">
<attributes><divisions>1</divisions></attributes>
<note><pitch><step>C</step><octave>4</octave></pitch><duration>4</duration><type>whole</type></note>
</measure></part>
</score-partwise>'''
for midi_program in (41, 1, 2):
parsed = converter.parse(score(midi_program), format='musicxml')
print(midi_program, [(type(i).__name__, i.midiProgram)
for i in parsed.recurse().getElementsByClass(instrument.Instrument)])
Expected vs. actual behavior
Expected a midiProgram of 40, 0 and 1. Actual:
41 [('Violin', 40)]
1 [('Instrument', None)]
2 [('Instrument', None)]
More information
The replacement is in MeasureParser's score-part handling (musicxml/xmlToM21.py):
# 2. midiProgram is Piano (often this is encoded only as piano for convenience)
if inst_from_name.midiProgram == i.midiProgram or isinstance(i, instrument.Piano):
i = inst_from_name
This isn't asking to remove the piano rule, only to not lose the program when the name doesn't give an instrument, for example by only replacing when the name was recognized, or by keeping i.midiProgram on the replacement.
- Ngôn ngữ chính
- Python
- Star
- 2.6k
- Fork
- 459
- Merge trung bình
- 1 ngày 7 giờ
- Pull request đã merge (30 ngày)
- 40
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của cuthbertLab/music21
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
cuthbertLab/music21#2082 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`TypeError` in `ChordReducer.run()` on multi-part `stream.Score` without instrument `partId`sĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
cuthbertLab/music21#2074 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
cuthbertLab/music21#2055 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Slur bezier-x/y from start element gets overwritten by stop element's valuesCó thể làm lại được @bingliscodes đã nhận 8 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
cuthbertLab/music21#2019 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
cuthbertLab/music21#1986 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của cuthbertLab/music21
Issue tương tự
-
md/asciidoc/csv: an explicit `encoding="utf-8"` keeps a leading BOM, the auto-detect path drops itĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
docling-project/docling#4846 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/sessions comp/dashboard comp/desktop comp/gateway comp/tui duplicate P2 sweeper:risk-session-state type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
NousResearch/hermes-agent#138914 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bot-triaged module: activation checkpointing module: inductor oncall: pt2 triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[oblt-aw][autodoc] Update PR Actions Detective E2E prerequisites and fix dashboard-format table typoĐang mởdocumentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
elastic/oblt-aw#2382 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày