====MusicXML in depth==== MusicXML is a //extensible markup language// file format (filename extension //.xml//) based on [[https://en.wikipedia.org/wiki/XML|XML]], which is explicitly designed to store musical notation. Although the most user-friendly way to interact with MusicXML is to use a score editor software (e.g. [[https://musescore.org/|Musescore]]), it is also quite possible to extract a lot of information from a MusicXML file using a conventional text editor (e.g. the Windows text editor or [[https://atom.io/|Atom]]). The internal structure of a MusicXML file is built hierarchically and is defined by elements, tags and attributes (see [[https://en.wikipedia.org/wiki/XML#Key_terminology |XML key terminlogy]], This illustrated by the following example : {{:wiki:musicxml_structure.png?500}} The structure used within MusicXML is largely compliant with common markup language standards and uses the MusicXML W3C XML schema. A detailed overview of this is available [[https://www.w3.org/2021/06/musicxml40/|here]]. The [[https://music-encoding.org|MEI]] format, which is also used for digital sheet music editions, is tied and compatible to the MusicXML format. ===Specification of work and composer=== The information on work and composer is usually stored at the beginning of a MusicXML file and is defined by the tags [[https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/work/|]] and [[https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/creator/|]]. In the following example, we can see what information is contained in the MusicXML version of the first movement of the Missa "La sol fa re mi" by Josquin Desprez ([[https://analyse.hfm-weimar.de/database/02/PrJode_Jos1102_COM_1-5_MissaLasol_002_00137.xml|here]] the link to the score): {{:wiki:musicxml_josquin.png?800}} In addition to the data contained within the [[https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/work/|]] tag, there is additional information about the work ("Kyrie") contained within, for example, [[https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/movement-title/|]] and as a "parentTitle" attribute in [[https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/miscellaneous/|]] tags. Python-based MusicXML parsing tools, such as [[https://web.mit.edu/music21/|music21]], can use this information for metadata searching. After metadata parsing by music21 the information contained in the example looks like this: {{:wiki:musicxml_parse1.png?400|}} Thus, by using certain tags and attributes in the MusicXML file, one defines the information read, which is crucial, for example, for building a corpus for a corpus study. An overview of the tags and attributes read by music21 in the context of metadata search can be found [[https://web.mit.edu/music21/doc/moduleReference/moduleMetadata.html#metadata|here]]. ===Voice and instrument information=== Usually, all information about the voices contained in a MusicXML file is defined within the [[https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/part-list/|]] tag. This contains not only the name of the instrument ([[https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/part-name/|]]), but also information that is provided in order to play the file within a score editor (various midi tags). In the following example we see the complete description of a voice: {{:wiki:musicxml_instrument.png?500|}} ===Notes=== Then, in the main part of the xml file follow the time signature, clef and note elements, divided by voices ([[https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/part-partwise/|]]) measure numbers ([[https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/measure-partwise/|]]). It is important to note that many of the data relate to the score layout and only selected tags refer to pitch and duration. In the following, you find a hierarchical overview: {{:wiki:music_xml-parts.png?200|}} Besides the already mentioned subdivision to [[https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/part-partwise/|]] and [[https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/measure-partwise/|]], especially the tags [[https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/attributes/|]] as well as [[https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/note/|]] contain all relevant information about the pitch and rhythm of the sheet music contained in the MusicXML file. [[https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/attributes/|]] usually contains all information about the measure itself, such as clef ([[https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/clef/|]]), time signature ([[https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/time/|