我是一名新手,对编程和Python不熟悉,但我的研究很多涉及从musicxml文件中提取数据。我有一段音乐,并希望提取出不属于调号的附加记号数量。我不知道如何做,请有经验的人帮忙。以下是我看到的一个小节的示例:
<measure number='19'>
<print new-system='no'/>
<note>
<rest/>
<duration>768</duration>
<voice>1</voice>
<type>quarter</type>
<staff>1</staff>
</note>
<backup>
<duration>768</duration>
</backup>
<note>
<pitch>
<step>E</step>
<octave>4</octave>
</pitch>
<duration>2304</duration>
<tie type='start'/>
<voice>2</voice>
<type>half</type>
<dot/>
<staff>1</staff>
<notations>
<tied type='start'/>
<slur type='stop' number='1'/>
</notations>
</note>
<backup>
<duration>1536</duration>
</backup>
<note>
<pitch>
<step>E</step>
<alter>3</alter>
<octave>3</octave>
</pitch>
<duration>1536</duration>
<voice>1</voice>
<type>half</type>
<staff>1</staff>
</note>
<note>
<chord/>
<pitch>
<step>G</step>
<alter>4</alter>
<octave>3</octave>
</pitch>
<duration>1536</duration>
<voice>1</voice>
<type>half</type>
<staff>1</staff>
</note>
<backup>
<duration>2304</duration>
</backup>
<note>
<pitch>
<step>E</step>
<octave>2</octave>
</pitch>
<duration>2304</duration>
<voice>5</voice>
<type>half</type>
<dot/>
<staff>2</staff>
</note>
</measure>
该问题需要在musicxml文件中搜索并计算出现的次数。
<pitch>
<step>*</step>
<alter>**</alter>
...
发生在 * 不是(F 或 C)的情况下,同时找到 * 是 F 或 C 的次数,并且没有紧接着
<alter>
标签的情况。任何帮助或建议都将不胜感激!