MusicXML import ignores `<sound tempo>` when the direction also has a `<metronome>`
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 52/100
Línea de trabajo
Start in MeasureParser.xmlDirection, where a direction's sound is only passed to setSound when no metronome was already created. Run the reproduction script and check what numberSounding holds for the sound tempo="90" case. Done when that case yields (60, 90) and matching tempos don't add a redundant numberSounding. Comparing against getQuarterBPM() is the approach the issue suggests.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
music21 version
10.5.0
Problem summary
When a <direction> has both a <metronome> and a <sound tempo>, the importer creates the MetronomeMark from the <metronome> and skips the <sound>. Usually the two agree, but they can differ: the metronome mark is what's printed, and <sound tempo> is the tempo for playback, for example a printed "♩ = 60" played at 90.
Steps to reproduce
from music21 import converter, tempo
xml = '''<score-partwise version="4.0">
<part-list><score-part id="P1"><part-name>Music</part-name></score-part></part-list>
<part id="P1"><measure number="1">
<attributes><divisions>1</divisions></attributes>
<direction>
<direction-type>
<metronome><beat-unit>quarter</beat-unit><per-minute>60</per-minute></metronome>
</direction-type>
<sound tempo="90"/>
</direction>
<note><pitch><step>C</step><octave>4</octave></pitch><duration>4</duration><type>whole</type></note>
</measure></part>
</score-partwise>'''
marks = converter.parse(xml, format='musicxml').flatten().getElementsByClass(tempo.MetronomeMark)
print([(mark.number, mark.numberSounding) for mark in marks])
Expected vs. actual behavior
Expected [(60, 90)], with the printed tempo as number and the playback tempo as numberSounding. Actual:
[(60, None)]
The 90 is lost.
More information
MeasureParser.xmlDirection only passes a direction's <sound> on to setSound if the direction didn't already have a <metronome>, to avoid making two MetronomeMarks.
<sound tempo> is always in quarter notes per minute, while <metronome> uses its own beat unit, so a dotted quarter = 60 with <sound tempo="90"/> agrees. A comparison would need to go through getQuarterBPM(), and numberSounding only needs setting when they really differ.
This matters most when <per-minute> isn't a plain number. It holds text, and scores often write "c. 60" or "60-72". Then the MetronomeMark has no number, even when exporters write the tempo in <sound tempo="60"/> right next to it:
<per-minute>c. 60</per-minute> with <sound tempo="60"/> → number None, getQuarterBPM() None
Reading <sound tempo> would give these marks a usable tempo.
- Lenguaje dominante
- Python
- Estrellas
- 2.6k
- Forks
- 459
- Merge medio
- 1 d 7 h
- PR fusionados (30 d)
- 40
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de cuthbertLab/music21
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
cuthbertLab/music21#2084 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
cuthbertLab/music21#2082 ·
Los mantenedores suelen responder en 1 día
-
`TypeError` in `ChordReducer.run()` on multi-part `stream.Score` without instrument `partId`sAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
cuthbertLab/music21#2074 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
cuthbertLab/music21#2055 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Slur bezier-x/y from start element gets overwritten by stop element's valuesQuizá libre de nuevo @bingliscodes la tomó hace 10 días y no hay ningún pull request abierto. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
cuthbertLab/music21#2019 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de cuthbertLab/music21
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
aws-samples/sample-per-model-bedrock#295 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 76/100
pyrevitlabs/pyRevit#3792 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
zephyrproject-rtos/reqmgmt#177 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
polarsource/polar#15580 ·
Los mantenedores suelen responder en 1 día
-
[开源推荐] Windows 系统维护工具箱,支持后台任务队列Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
521xueweihan/HelloGitHub#4011 ·