This module defines an object representation of MusicXML, used for converting to and from MusicXML and music21.
Inherits from: MusicXMLElement, XMLNode
Used inside an ornament definition; chardata holds the accidental type
Inherits from: MusicXMLElement, XMLNode
This is not an XML object, but a container for all XML articulation tags.
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
Inherits from: MusicXMLElement, XMLNode
Attributes attributes
Attributes without Documentation: transposeObj, divisions, directive, clefList, timeList, staves, measureStyleObj, staffDetailsList, keyList
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Attributes properties
Attributes methods
- setDefaultDivisions()¶
Utility to just set the divisions parameters
- setDefaults()¶
No documentation.
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
Backup attributes
Attributes without Documentation: duration
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Backup properties
Backup methods
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
Barline attributes
Attributes without Documentation: repeatObj, barStyle, endingObj
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Barline properties
Barline methods
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
A root defines a pitch, with a step and an alter
Bass attributes
Attributes without Documentation: bassStep, bassAlter
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Bass properties
Bass methods
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
Beams are specified is individual objects for each beam, in order, where the beam number refers to its duration representation (8th, 16th, etc) and its character data specifies whether it is begin/continue/end (for normal beams) or backward hook/forward wook (for beams that do not continue are attached only to the staff). These character data values can be mixed: one beam can continue while another can hook or end.
1 = 8th 2 = 16th 3 = 32th 4 = 64th 5 = 128th 6 = 256th
From musicxml.xsd:
Beam values include begin, continue, end, forward hook, and backward hook. Up to six concurrent beam levels are available to cover up to 256th notes. The repeater attribute, used for tremolos, needs to be specified with a “yes” value for each beam using it. Beams that have a begin value can also have a fan attribute to indicate accelerandos and ritardandos using fanned beams. The fan attribute may also be used with a continue value if the fanning direction changes on that note. The value is “none” if not specified.
Note that the beam number does not distinguish sets of beams that overlap, as it does for slur and other elements. Beaming groups are distinguished by being in different voices and/or the presence or absence of grace and cue
Inherits from: MusicXMLElement, XMLNode
Inherits from: MusicXMLElement, XMLNode
Part of <metronome> tags
Inherits from: MusicXMLElement, XMLNode
Part of <metronome> tags
Inherits from: MusicXMLElement, XMLNode
>>> from music21 import *
>>> b = musicxml.Bracket()
>>> b.tag
'bracket'
Inherits from: MusicXMLElement, XMLNode
Clef attributes
Attributes without Documentation: clefOctaveChange, sign, line
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Clef properties
Clef methods
- setDefaults()¶
No documentation.
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
>>> from music21 import *
>>> a = musicxml.Creator()
>>> a.tag
'creator'
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
The credit tag stores on or more credit-words tags, defining text positioned on a page.
>>> from music21 import *
>>> a = musicxml.Credit()
>>> a.tag
'credit'
>>> a.setDefaults()
>>> b = musicxml.CreditWords('testing')
>>> a.append(b)
>>> print a
<credit page=1 <credit-words charData=testing>>
Inherits from: MusicXMLElement, XMLNode
>>> from music21 import *
>>> a = musicxml.CreditWords()
>>> a.tag
'credit-words'
Inherits from: MusicXMLElement, XMLNode
>>> from music21 import *
>>> d = musicxml.Dashes()
>>> d.tag
'dashes'
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
from musicxml schema:
The defaults type specifies score-wide defaults for scaling, layout, and appearance.
- <xs:sequence>
<xs:element name=”scaling” type=”scaling” minOccurs=”0”/> <xs:group ref=”layout”/> <xs:element name=”appearance” type=”appearance” minOccurs=”0”/> <xs:element name=”music-font” type=”empty-font” minOccurs=”0”/> <xs:element name=”word-font” type=”empty-font” minOccurs=”0”/> <xs:element name=”lyric-font” type=”lyric-font” minOccurs=”0” maxOccurs=”unbounded”/> <xs:element name=”lyric-language” type=”lyric-language” minOccurs=”0” maxOccurs=”unbounded”/></xs:sequence>
Defaults attributes
Attributes without Documentation: musicFontObj, lyricLanguage, lyricFontObj, scalingObj, appearanceObj, layoutList, wordFontObj
Attributes inherited from MusicXMLElementList: componentList
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Defaults properties
Defaults methods
Methods inherited from MusicXMLElementList: append(), insert()
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
The degree type is used to add, alter, or subtract individual notes in the chord.
Inherits from: MusicXMLElement, XMLNode
Chromatic alteration of current degree
Inherits from: MusicXMLElement, XMLNode
addition, alteration, subtraction relative to the kind of current chord
Inherits from: MusicXMLElement, XMLNode
Stores 1 for root, 3 for third, etc
Inherits from: MusicXMLElement, XMLNode
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
One or more Direction objects are found in measures, after an attributes object. Within the Direction object may be a number of objects, including DirectionType, Sound.
Direction attributes
Attributes without Documentation: offset, staff
Attributes inherited from MusicXMLElementList: componentList
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Direction properties
Direction methods
- getBracket()¶
Search this direction and determine if it contains a segno mark.
>>> from music21 import * >>> a = musicxml.Direction() >>> b = musicxml.DirectionType() >>> c = musicxml.Bracket() >>> b.append(c) >>> a.append(b) >>> a.getBracket() is not None True
- getCoda()¶
Search this direction and determine if it contains a coda mark.
>>> from music21 import * >>> a = musicxml.Direction() >>> b = musicxml.DirectionType() >>> c = musicxml.Coda() >>> b.append(c) >>> a.append(b) >>> a.getCoda() is not None True
- getDashes()¶
Search this direction and determine if it contains a segno mark.
>>> from music21 import * >>> a = musicxml.Direction() >>> b = musicxml.DirectionType() >>> c = musicxml.Dashes() >>> b.append(c) >>> a.append(b) >>> a.getDashes() is not None True
- getDynamicMark()¶
Search this direction and determine if it contains a dynamic mark, return, otherwise, return None
>>> from music21 import * >>> a = musicxml.Direction() >>> b = musicxml.DirectionType() >>> c = musicxml.Dynamics() >>> d = musicxml.DynamicMark('f') >>> c.append(d) >>> b.append(c) >>> a.append(b) >>> a.getDynamicMark() is not None True
- getMetronome()¶
Search this direction and determine if it contains a dynamic mark.
>>> from music21 import * >>> a = musicxml.Direction() >>> b = musicxml.DirectionType() >>> c = musicxml.Metronome() >>> b.append(c) >>> a.append(b) >>> a.getMetronome() is not None True
- getSegno()¶
Search this direction and determine if it contains a segno mark.
>>> from music21 import * >>> a = musicxml.Direction() >>> b = musicxml.DirectionType() >>> c = musicxml.Segno() >>> b.append(c) >>> a.append(b) >>> a.getSegno() is not None True
- getWedge()¶
Search this direction and determine if it contains a dynamic mark.
>>> from music21 import * >>> a = musicxml.Direction() >>> b = musicxml.DirectionType() >>> c = musicxml.Wedge('crescendo') >>> b.append(c) >>> a.append(b) >>> a.getWedge() is not None True
- getWords()¶
Search this direction and determine if it contains a Words entity.
>>> from music21 import * >>> a = musicxml.Direction() >>> b = musicxml.DirectionType() >>> c = musicxml.Words('crescendo') >>> b.append(c) >>> a.append(b) >>> a.getWords() == [c] True >>> a.getWords()[0].charData 'crescendo'Methods inherited from MusicXMLElementList: append(), insert()
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
DirectionType stores objects like Pedal, dynamics, wedge, and words
Inherits from: MusicXMLElement, XMLNode
Inherits from: MusicXMLElement, XMLNode
Inherits from: MusicXMLElement, XMLNode
This is not an XML object in the normal sense, but a container for all XML dynamic tags. Dynamic tags have no attributes or elements. Tags inlcude common marks such as p, pp, ff, etc.
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
Inherits from: MusicXMLElement, XMLNode
Encoding attributes
Attributes without Documentation: encodingDate, supportsList, softwareList
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Encoding properties
Encoding methods
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
Ending tags are stored in Barline tags to indicate the start ane end of a repeat bracket, used to designate an alternate repeat.
Inherits from: MusicXMLElement, XMLNode
Forward attributes
Attributes without Documentation: duration
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Forward properties
Forward methods
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
>>> from music21 import *
>>> g = musicxml.Glissando()
>>> g.tag
'glissando'
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
A harmony tag stores a root, kind – eventually becomes converted to a music21 ChordSymbol object (not Harmony; though ChordSymbol is a subclass of the music21 object called Harmony, which also deals with Figured bass and Roman Numerals.
Harmony attributes
Attributes without Documentation: function, inversion, rootObj, degreeObj, kindObj, bassObj
Attributes inherited from MusicXMLElementList: componentList
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Harmony properties
Harmony methods
Methods inherited from MusicXMLElementList: append(), insert()
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
>>> from music21 import *
>>> a = musicxml.Identification()
>>> a.tag
'identification'
Identification attributes
Attributes without Documentation: rights, encodingObj, creatorList
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Identification properties
Identification methods
- setDefaults()¶
No documentation.
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
Inherits from: MusicXMLElement, XMLNode
Inherits from: MusicXMLElement, XMLNode
Key attributes
Attributes without Documentation: mode, nonTraditionalKeyList, cancel, fifths
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Key properties
Key methods
- setDefaults()¶
No documentation.
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
A harmony tag stores a root, kind
Inherits from: MusicXMLElement, XMLNode
Multiple Lyric objects can be defined within a single Note.
Lyric attributes
Attributes without Documentation: text, syllabic
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Lyric properties
Lyric methods
- filterLyric(text)¶
Remove and fix character strings that cause problems in MusicXML
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
MIDIInstrument attributes
Attributes without Documentation: midiBank, volume, midiUnpitched, pan, elevation, midiChannel, midiProgram, midiName
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
MIDIInstrument properties
MIDIInstrument methods
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
Measure attributes
Attributes without Documentation: attributesObj
Attributes inherited from MusicXMLElementList: componentList
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Measure properties
Measure methods
- getVoiceCount()¶
Return the number of voices defined in this Measure; this must be called after update().
- getVoiceIndices()¶
Return a list of unique sorted voice ids.
- setDefaults()¶
No documentation.
- update()¶
This method looks at all note, forward, and backup objects and updates divisons and attributes references
Methods inherited from MusicXMLElementList: append(), insert()
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
MeasureStyle attributes
Attributes without Documentation: multipleRest
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
MeasureStyle properties
MeasureStyle methods
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
A direction type used to store tempo indications, consisting of a <beat-unit> tag (a duration) as well as a <per-unit> tag (a number). Also used to store metric modulations.
>>> from music21 import *
>>> m = musicxml.Metronome()
>>> bu1 = musicxml.BeatUnit('half')
>>> m.append(bu1)
>>> m.isMetricModulation()
False
Metronome attributes
Attributes inherited from MusicXMLElementList: componentList
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Metronome properties
Metronome methods
- isMetricModulation()¶
Return True if this Metronome defines a metric modulation. If there are more than on <beat-unit> tag, than this is True
>>> from music21 import * >>> m = musicxml.Metronome() >>> bu1 = musicxml.BeatUnit('half') >>> bu2 = musicxml.BeatUnit('quarter') >>> m.append(bu1) >>> m.append(bu2) >>> m.isMetricModulation() TrueMethods inherited from MusicXMLElementList: append(), insert()
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: XMLNode
MusicXML elements are an abstraction of MusicXML into an object oriented framework. Some, not all, of MusicXML elements are represented as objects. Some sub-elements are much more simply placed as attributes of parent objects. These simple elements have only a tag and character data. Elements that have attributes and/or sub-elements, however, must be represented as objects.
These tests are module specific and should be loaded as unittests, below
>>> from music21 import *
>>> a = musicxml.MusicXMLElement()
>>> a._convertNameToXml('groupAbbreviation')
'group-abbreviation'
>>> a._convertNameToXml('midiUnpitched')
'midi-unpitched'
>>> a._convertNameToXml('groupNameDisplay')
'group-name-display'
>>> a._convertNameToXml('group-name-display')
'group-name-display'
>>> a = musicxml.MusicXMLElement()
>>> a._convertNameFromXml('group-abbreviation')
'groupAbbreviation'
>>> a._convertNameFromXml('midi-unpitched')
'midiUnpitched'
>>> a._convertNameFromXml('midiUnpitched')
'midiUnpitched'
>>> a._convertNameFromXml('opus')
'opus'
>>> a._convertNameFromXml('group-name-display')
'groupNameDisplay'
>>> a = musicxml.MusicXMLElement()
>>> len(a._publicAttributes())
3
>>> print(a._publicAttributes())
['charData', 'external', 'tag']
MusicXMLElement attributes
Attributes without Documentation: external
Attributes inherited from XMLNode: charData
MusicXMLElement properties
MusicXMLElement methods
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
MusicXML that is designed to function as a list. In general, this is an element this only used to contain other Elements. List operations permit easy access and manipuation.
Note that design here mirrors that of node.py NodeList, but this needs to be a subclass of of MusicXMLElement
MusicXMLElementList attributes
Attributes without Documentation: componentList
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
MusicXMLElementList properties
MusicXMLElementList methods
- append(item)¶
No documentation.
- insert(position, item)¶
No documentation.
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
Notations contains many elements, including Ornaments. Most of these are stored in the .componentList
Notations attributes
Attributes inherited from MusicXMLElementList: componentList
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Notations properties
Notations methods
- getArticulations()¶
A quick way to get all articulations objects; there may be more than one.
Returns a list of ArticulationMark objects
- getFermatas()¶
Get all Fermatas from the componentList as a list
- getGlissandi()¶
Get all glissandi objects stored on components. There can be more than one.
>>> from music21 import * >>> g1 = musicxml.Glissando() >>> g2 = musicxml.Glissando() >>> n = musicxml.Notations() >>> n.append(g1) >>> n.append(g2) >>> n.getGlissandi() [<glissando >, <glissando >]
- getOrnaments()¶
Get all ornament objects stored on componentList. There can be more than one.
- getSlurs()¶
Get all Slurs from the componentList as a list
- getTechnical()¶
A quick way to get all technical objects; there may be more than one.
Returns a list of TechnicalMark objects
- getTieds()¶
A quick way to get all tied objects; there is likely only one, but we return a list anyhow.
- getTremolos()¶
Get one or more tremolo line objects Stored in Ornaments
>>> from music21 import * >>> t = musicxml.Tremolo() >>> o = musicxml.Ornaments() >>> n = musicxml.Notations() >>> o.append(t) >>> n.append(o) >>> n.getTremolos() [<tremolo >]
- getTuplets()¶
A quick way to get all tuplets; there is likely only one, but we return a list anyhow.
- getWavyLines()¶
Get one or more wavy line objects Stored in Ornaments
>>> from music21 import * >>> wl = musicxml.WavyLine() >>> o = musicxml.Ornaments() >>> n = musicxml.Notations() >>> o.append(wl) >>> n.append(o) >>> n.getWavyLines() [<wavy-line >]Methods inherited from MusicXMLElementList: append(), insert()
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
Note attributes
Attributes without Documentation: chord, timeModificationObj, duration, staff, type, dotList, graceObj, accidentalObj, stem, lyricList, beamList, restObj, noteheadObj, tieList, notationsObj, pitchObj, voice
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Note properties
Note methods
- setDefaults()¶
No documentation.
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
>>> from music21 import *
>>> os = musicxml.OctaveShift()
>>> os.tag
'octave-shift'
Inherits from: MusicXMLElement, XMLNode
A musicxml <offset> element can be found defined in the <direction> element. the charData stores a number that is the shift in divisions from the location of the tag.
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
The Ornaments tag wraps the following muscixml entities: trill-mark, turn, delayed-turn, inverted-turn, shake, wavy-line, mordent, inverted mordent, schleifer, tremolo, other-ornament.
Ornaments are stored on the notations object.
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
PageLayout attributes
Attributes without Documentation: pageWidth, pageHeight
Attributes inherited from MusicXMLElementList: componentList
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
PageLayout properties
PageLayout methods
Methods inherited from MusicXMLElementList: append(), insert()
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
Does not support the type = (odd|even|both) attribute
PageMargins attributes
Attributes without Documentation: bottomMargin, topMargin, rightMargin, leftMargin
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
PageMargins properties
PageMargins methods
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
This assumes a part-wise part
Part attributes
Attributes inherited from MusicXMLElementList: componentList
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Part properties
Part methods
- getStavesCount()¶
Look ahead into the measure Attributes and return the highest number of staves used in this part.
- setDefaults()¶
No documentation.
Methods inherited from MusicXMLElementList: append(), insert()
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
The PartGroup tag is stored in the PartList, intermingled with ScorePart tags and other definitions.
PartGroup attributes
Attributes without Documentation: groupNameDisplay, groupAbbreviationDisplay, groupBarline, groupSymbol, groupName, groupTime, groupAbbreviation
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
PartGroup properties
PartGroup methods
- setDefaults()¶
No documentation.
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), toxml(), xmlStr()
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
The PartList defines the parts, as well as their names and abbreviations.
It stores the parts in its .componentList list in order.
Additionally, the order of this list is used as a way specifying arrangements of brackets and/or braces that group parts in partGroup objects.
The order of this list thus matters.
The PartList for a score is usually accessed from the Score (musicxml.Score) object’s .partListObj parameter.
Inherits from: MusicXMLElement, XMLNode
Part of <metronome> tags
Inherits from: MusicXMLElement, XMLNode
Pitch attributes
Attributes without Documentation: step, octave, alter
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Pitch properties
Pitch methods
- setDefaults()¶
No documentation.
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), toxml(), xmlStr()
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
from direction.mod:
The print element contains general printing parameters, including the layout elements defined in the layout.mod file. The part-name-display and part-abbreviation-display elements used in the score.mod file may also be used here to change how a part name or abbreviation is displayed over the course of a piece. They take effect when the current measure or a succeeding measure starts a new system.
The new-system and new-page attributes indicate whether to force a system or page break, or to force the current music onto the same system or page as the preceding music. Normally this is the first music data within a measure. If used in multi-part music, they should be placed in the same positions within each part, or the results are undefined. The page-number attribute sets the number of a new page; it is ignored if new-page is not “yes”. Version 2.0 adds a blank-page attribute. This is a positive integer value that specifies the number of blank pages to insert before the current measure. It is ignored if new-page is not “yes”. These blank pages have no music, but may have text or images specified by the credit element. This is used to allow a combination of pages that are all text, or all text and images, together with pages of music.
Staff spacing between multiple staves is measured in tenths of staff lines (e.g. 100 = 10 staff lines). This is deprecated as of Version 1.1; the staff-layout element should be used instead. If both are present, the staff-layout values take priority.
Layout elements in a print statement only apply to the current page, system, staff, or measure. Music that follows continues to take the default values from the layout included in the defaults element.
<!ELEMENT print (page-layout?, system-layout?, staff-layout*, measure-layout?, measure-numbering?, part-name-display?, part-abbreviation-display?)> <!ATTLIST print staff-spacing %tenths; #IMPLIED new-system %yes-no; #IMPLIED new-page %yes-no; #IMPLIED blank-page NMTOKEN #IMPLIED page-number CDATA #IMPLIED>
Supported in music21: page-layout system-layout new-system new-page page-number
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
Inherits from: MusicXMLElement, XMLNode
A root defines a pitch, with a step and an alter
Root attributes
Attributes without Documentation: rootStep, rootAlter
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Root properties
Root methods
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
Scaling attributes
Attributes without Documentation: millimeters, tenths
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Scaling properties
Scaling methods
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
Score is used to collect score header elements and, if available, all other MusicXML data. Score can be used for partwise or timewise scores. This object includes all MusicXML score information.
>>> from music21 import *
>>> a = musicxml.Score()
>>> a.tag
'score-partwise'
>>> a.setDefaults()
>>> b = musicxml.Identification()
>>> b.setDefaults()
>>> a.set('identification', b)
>>> c = musicxml.Score()
>>> d = c.merge(a)
Score attributes
Attributes without Documentation: workObj, m21Version, partListObj, movementTitle, encodingObj, creditList, defaultsObj, identificationObj, movementNumber
Attributes inherited from MusicXMLElementList: componentList
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Score properties
Score methods
- getPart(partId)¶
Get a part, given an id.
>>> from music21 import * >>> from music21.musicxml import testPrimitive >>> from music21.musicxml import xmlHandler >>> b = xmlHandler.Document() >>> b.read(testPrimitive.ALL[0]) >>> c = b.score.getPart(b.score.partIdToNameDict().keys()[0]) >>> c <part id=P1 <measure width=983 number=1 <print <system-layout... >>> isinstance(c, musicxml.Part) True >>> isinstance(c, stream.Part) False
- getPartGroupData()¶
Get part groups organized by part id in dictionaries.
Returns a list of dictionaries, each dictionary containing number, a list of part ids, and a mx PartGroup object.
- getPartIds()¶
A quick way to get all valid part ids in the componentList
- getPartIdsFromPartListObj()¶
A quick way to get all valid part ids in the partListObj for each one that is a ScorePart
- getScorePart(partId)¶
Get an instrument, as defined in a ScorePart object, from a Score.
>>> from music21 import * >>> a = musicxml.Score() >>> a.setDefaults() >>> a.getScorePart('P3') == None True >>> from music21.musicxml import testPrimitive >>> from music21.musicxml import xmlHandler >>> b = xmlHandler.Document() >>> b.read(testPrimitive.pitches01a) >>> b.score.getScorePart(b.score.partIdToNameDict().keys()[0]) <score-part id=P1 part-name=MusicXML Part>
- partIdToNameDict()¶
A quick way to get a mapping of valid part ids to the part names from a Score (musicxml.Score) object in the .partListObj property.
Returns a dictionary mapping part id to part-name for each ScorePart in .partListObj.
Note that dictionaries are not sorted, so the order of .partListObj still needs to be used.
- setDefaults()¶
No documentation.
Methods inherited from MusicXMLElementList: append(), insert()
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
ScoreInstrument attributes
Attributes without Documentation: instrumentName, solo, instrumentAbbreviation, ensemble
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
ScoreInstrument properties
ScoreInstrument methods
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
Lives in a PartList
ScorePart attributes
Attributes without Documentation: partName, scoreInstrumentList, partAbbreviation, midiInstrumentList
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
ScorePart properties
ScorePart methods
- setDefaults()¶
No documentation.
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
Defines the Software that created this MusicXML document.
Inherits from: MusicXMLElement, XMLNode
A direction type used to store a large variety of performance indications.
These tags seem to be found most often in <direction> tags, usually following a symbolic definition. For example, MetronomeMark definitions are often followed by a <sound> definition.
Other <sound> tags are found after the <attributes> tag in a measure, often defining tempo.
Inherits from: MusicXMLElement, XMLNode
StaffDetails attributes
Attributes without Documentation: staffSize
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
StaffDetails properties
StaffDetails methods
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
StaffLayout attributes
Attributes without Documentation: staffDistance
Attributes inherited from MusicXMLElementList: componentList
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
StaffLayout properties
StaffLayout methods
Methods inherited from MusicXMLElementList: append(), insert()
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
Defines what sorts of notation this encoding supports
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
SystemLayout attributes
Attributes without Documentation: topSystemDistance, systemDistance
Attributes inherited from MusicXMLElementList: componentList
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
SystemLayout properties
SystemLayout methods
Methods inherited from MusicXMLElementList: append(), insert()
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
SystemMargins attributes
Attributes without Documentation: bottomMargin, topMargin, rightMargin, leftMargin
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
SystemMargins properties
SystemMargins methods
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Object to store tags as encountered by SAX. Tags can be open or closed based on the status attribute. Tags can store character data collected between their defined tags.
These objects are used only for finding and collecting tag attributes and elements. As we do not need character data for all tags, tags have an optional flag to select if the are to collect character data.
>>> from music21 import *
>>> t = musicxml.Tag('note')
>>> t.start()
>>> t.start() # catch double starts
Traceback (most recent call last):
TagException: Tag (note) is already started.
Tag methods
An object to store all MusicXML tags as Tag objects. Tag objects are used just to identify tags, store element contents and status in SAX parsing.
With this design some tags (called simple elements) can be used simply in SAX parsing as structural monitors, but not be instantiated as objects for content delivery.
>>> from music21 import *
>>> tl = musicxml.TagLib()
>>> tl['voice'].tag
'voice'
>>> tl['voice'].status # open or closed
False
>>> tl.audit()
(True, 'TagLib audit: no errors found.')
>>> tl['note'].start()
>>> tl.audit()
(False, 'TagLib audit: 1 errors found:\ntag <note> left open')
TagLib attributes
Attributes without Documentation: tagsAll, tagsCharData
TagLib methods
- audit()¶
A way to check for errors in SAX parsing. Assumes that all start() calls have been paired with an end() call, and that all element data has been cleared.
- getClassName(key)¶
Get the class or name, or None if none defined.
>>> from music21 import * >>> tl = musicxml.TagLib() >>> tl.getClassName('voice')
- keys()¶
No documentation.
- statClear()¶
No documentation.
- statRun()¶
No documentation.
Inherits from: MusicXMLElementList, MusicXMLElement, XMLNode
Class for the <technical> musicxml mark which contains things like <up-bow> etc. objects
Inherits from: MusicXMLElement, XMLNode
This is not an XML object, but a container for all XML technical tags.
Inherits from: MusicXMLElement, XMLNode
Time attributes
Attributes without Documentation: componentList, senzaMisura
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Time properties
Time methods
- setDefaults()¶
No documentation.
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
TimeModification attributes
Attributes without Documentation: normalType, normalDot, normalNotes, actualNotes
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
TimeModification properties
TimeModification methods
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
Transpose attributes
Attributes without Documentation: diatonic, double, chromatic, octaveChange
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Transpose properties
Transpose methods
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), setDefaults(), toxml(), xmlStr()
Inherits from: MusicXMLElement, XMLNode
Tremolo may or may not extend over multiple notes. Char data may store integer number.
Inherits from: MusicXMLElement, XMLNode
Inherits from: MusicXMLElement, XMLNode
Stored in notations object and governs presentation and bracket.
Inherits from: MusicXMLElement, XMLNode
A wavy line that extends across many notes or measures.
>>> from music21 import *
>>> wl = musicxml.WavyLine()
>>> wl.tag
'wavy-line'
Inherits from: MusicXMLElement, XMLNode
>>> from music21 import *
>>> w = musicxml.Wedge()
>>> w.tag
'wedge'
Inherits from: MusicXMLElement, XMLNode
A direction type that can be used for arbitrary text expressions, and font formatting
Inherits from: MusicXMLElement, XMLNode
>>> from music21 import *
>>> a = musicxml.Work()
>>> a.tag
'work'
Work attributes
Attributes without Documentation: workNumber, opus, workTitle
Attributes inherited from MusicXMLElement: external
Attributes inherited from XMLNode: charData
Work properties
Work methods
- setDefaults()¶
No documentation.
Methods inherited from XMLNode: get(), getNewDoc(), hasAttrs(), loadAttrs(), merge(), set(), toxml(), xmlStr()