Exemplo n.º 1
0
class ComplexTypeHarmonic(ComplexType, PrintObject, PrintStyle, Placement):
    """
    The harmonic type indicates natural and artificial harmonics. Allowing the type of pitch to be specified, combined
    with controls for appearance/playback differences, allows both the notation and the sound to be represented.
    Artificial harmonics can add a notated touching-pitch; artificial pinch harmonics will usually not notate a touching
    pitch. The attributes for the harmonic element refer to the use of the circular harmonic symbol, typically but not
    always used with natural harmonics.
    """
    _DTD = Sequence(
        Choice(
            Element(Natural),
            Element(Artificial),
            min_occurrence=0
        ),
        Choice(
            Element(BasePitch),
            Element(TouchingPitch),
            Element(SoundingPitch),
            min_occurrence=0
        )

    )

    def __init__(self, tag, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)
Exemplo n.º 2
0
class ComplexTypePartList(ComplexType):
    """
    The part-list identifies the different musical parts in this movement. Each part has an ID that is used later within
    the musical data. Since parts may be encoded separately and combined later, identification elements are present at
    both the score and score-part levels. There must be at least one score-part, combined as desired with part-group
    elements that indicate braces and brackets. Parts are ordered from top to bottom in a score based on the order in
    which they appear in the part-list.
    """
    # _DTD = Sequence(
    #     Element(PartGroup, min_occurrence=0, max_occurrence=None),
    #     Element(ScorePart),
    #     Choice(
    #         Element(PartGroup),
    #         Element(ScorePart),
    #         min_occurrence=0, max_occurrence=None
    #     )
    # )
    _DTD = Sequence(
        Choice(Element(PartGroup, min_occurrence=0, max_occurrence=None),
               Element(ScorePart)),
        Choice(Element(PartGroup),
               Element(ScorePart),
               min_occurrence=0,
               max_occurrence=None))

    def __init__(self, tag, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)
Exemplo n.º 3
0
class ComplexTypeStaffDetails(ComplexType, ShowFrets, PrintObject,
                              PrintSpacing):
    """ The staff-details element is used to indicate different types of staves. The optional number
    attribute specifies the staff number from top to bottom on the system, as with clef. The print-object
    attribute is used to indicate when a staff is not printed in a part, usually in large scores where empty
    parts are omitted. It is yes by default. If print-spacing is yes while print-object is no, the score is
    printed in cutaway format where vertical space is left for the empty part.
    """
    _DTD = Sequence(
        Element(StaffType, min_occurrence=0),
        Element(StaffLines, min_occurrence=0),
        Element(StaffTuning, min_occurrence=0, max_occurrence=None),
        Element(Capo, min_occurrence=0),
        Element(StaffSize, min_occurrence=0),
    )

    def __init__(self, tag, number=1, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)
        self.number = number

    @property
    def number(self):
        return self.get_attribute('number')

    @number.setter
    def number(self, value):
        if value is None:
            self.remove_attribute('number')
        else:
            TypeStaffNumber(value)
            self._ATTRIBUTES.insert(0, 'number')
            self.set_attribute('number', value)
Exemplo n.º 4
0
class ComplexTypeHole(ComplexType, PrintStyle, Placement):
    """The hole type represents the symbols used for woodwind and brass fingerings as well as other notations."""
    _DTD = Sequence(Element(HoleType, min_occurrence=0), Element(HoleClosed),
                    Element(HoleShape, min_occurrence=0))

    def __init__(self, tag, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)
Exemplo n.º 5
0
class ComplexTypeVirtualInstrument(ComplexType):
    """
    The virtual-instrument element defines a specific virtual instrument used for an instrument sound.
    """
    _DTD = Sequence(Element(VirtualLibrary, min_occurrence=0),
                    Element(VirtualName, min_occurrence=0))

    def __init__(self, tag, value=None, *args, **kwargs):
        super().__init__(tag=tag, value=value, *args, **kwargs)
Exemplo n.º 6
0
class ComplexTypeAppearance(ComplexType):
    """The appearance type controls general graphical settings for the music's final form appearance on a printed page
    of display. This includes support for line widths, definitions for note sizes, and standard distances between
    notation elements, plus an extension element for other aspects of appearance."""

    _DTD = Sequence(Element(LineWidth, 0, None), Element(NoteSize, 0, None),
                    Element(Distance, 0, None), Element(Glyph, 0, None),
                    Element(OtherAppearance, 0, None))

    def __init__(self, tag, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)
Exemplo n.º 7
0
class ComplexTypeTupletPortion(ComplexType):
    """
    The tuplet-portion type provides optional full control over tuplet specifications. It allows the number and note
    type (including dots) to be set for the actual and normal portions of a single tuplet. If any of these elements are
    absent, their values are based on the time-modification element.
    """
    _DTD = Sequence(Element(TupletNumber, min_occurrence=0),
                    Element(TupletType, min_occurrence=0),
                    Element(TupletDot, min_occurrence=0, max_occurrence=None))

    def __init__(self, tag, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)
Exemplo n.º 8
0
class XMLExample(XMLElement, AttributeExample):
    """
    some documentation
    """
    _ATTRIBUTES = ['attribute-example']
    _DTD = Sequence(
        Element(XMLExampleChild1, min_occurrence=0),
        Element(XMLExampleChild, min_occurrence=0, max_occurrence=None)

    )

    def __init__(self, attribute_example=None, *args, **kwargs):
        super().__init__(tag='example', attribute_example=attribute_example, *args, **kwargs)
Exemplo n.º 9
0
class ComplexTypeTuplet(ComplexType, Bracket, ShowNumber, ShowType, LineShape,
                        Position, Placement, OptionalUniqueId):
    """
    A tuplet element is present when a tuplet is to be displayed graphically, in addition to the sound data provided by
    the time-modification elements. The number attribute is used to distinguish nested tuplets. The bracket attribute is
    used to indicate the presence of a bracket. If unspecified, the results are implementation-dependent. The line-shape
    attribute is used to specify whether the bracket is straight or in the older curved or slurred style. It is straight
    by default.

    Whereas a time-modification element shows how the cumulative, sounding effect of tuplets and double-note tremolos
    compare to the written note type, the tuplet element describes how this is displayed. The tuplet element also
    provides more detailed representation information than the time-modification element, and is needed to represent
    nested tuplets and other complex tuplets accurately.

    The show-number attribute is used to display either the number of actual notes, the number of both actual and normal
    notes, or neither. It is actual by default. The show-type attribute is used to display either the actual type, both
    the actual and normal types, or neither. It is none by default.
    """
    _DTD = Sequence(Element(TupletActual, min_occurrence=0),
                    Element(TupletNormal, min_occurrence=0))

    def __init__(self, type, number=1, *args, **kwargs):
        super().__init__(tag='tuplet', *args, **kwargs)
        self.type = type
        self.number = number

    @property
    def number(self):
        return self.get_attribute('number')

    @number.setter
    def number(self, value):
        if value is None:
            self.remove_attribute('number')
        else:
            TypeNumberLevel(value)
            self._ATTRIBUTES.insert(0, 'number')
            self.set_attribute('number', value)

    @property
    def type(self):
        return self.get_attribute('type')

    @type.setter
    def type(self, value):
        if value is None:
            self.remove_attribute('type')
        else:
            TypeStartStop(value)
            self._ATTRIBUTES.insert(0, 'type')
            self.set_attribute('type', value)
Exemplo n.º 10
0
class ComplexTypeNameDisplay(ComplexType, PrintObject):
    """ The name-display type is used for exact formatting of multi-font text in part and group names to the left of
    the system. The print-object attribute can be used to determine what, if anything, is printed at the start of each
    system. Enclosure for the display-text element is none by default. Language for the display-text element is Italian
    ("it") by default.
    """
    _DTD = Sequence(
        Choice(Element(DisplayText),
               Element(AccidentalText),
               min_occurrence=0,
               max_occurrence=None))

    def __init__(self, tag, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)
Exemplo n.º 11
0
class ComplexTypeScaling(ComplexType):
    """
    Margins, page sizes, and distances are all measured in tenths to keep MusicXML data in a consistent coordinate
    system as much as possible. The translation to absolute units is done with the scaling type, which specifies how
    many millimeters are equal to how many tenths. For a staff height of 7mm, millimeters would be set to 7 while tenths
    is set to 40. The ability to set a formula rather than a single scaling factor helps avoid roundoff errors.
    """
    _DTD = Sequence(
        Element(Millimeters),
        Element(Tenths)
    )

    def __init__(self, tag, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)
Exemplo n.º 12
0
class ComplexTypeMidiInstrument(ComplexType):
    """The midi-instrument type defines MIDI 1.0 instrument playback. The midi-instrument element can be a part of
    either the score-instrument element at the start of a part, or the sound element within a part. The id attribute
    refers to the score-instrument affected by the change."""

    _ATTRIBUTES = []
    _DTD = Sequence(Element(MidiChannel, min_occurrence=0),
                    Element(MidiName, min_occurrence=0),
                    Element(MidiBank, min_occurrence=0),
                    Element(MidiProgram, min_occurrence=0),
                    Element(MidiUnpitched, min_occurrence=0),
                    Element(Volume, min_occurrence=0),
                    Element(Pan, min_occurrence=0),
                    Element(Elevation, min_occurrence=0))

    def __init__(self, tag, id_, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)
        self.id = id_

    @property
    def id(self):
        return self.get_attribute('id')

    @id.setter
    def id(self, value):
        if value is None:
            self.remove_attribute('id')
        else:
            IDREF(value)
            self._ATTRIBUTES.insert(0, 'id')
            self.set_attribute('id', value)
Exemplo n.º 13
0
class Score(XMLElement, DocumentAttributes):
    """The score-partwise element is the root element for a partwise MusicXML score. It includes a score-header group
    followed by a series of parts with measures inside. The document-attributes attribute group includes the version
    attribute.
    """
    _DTD = Sequence(GroupReference(ScoreHeader),
                    Element(Part, max_occurrence=None))

    def __init__(self, *args, **kwargs):
        super().__init__(tag='score-partwise', *args, **kwargs)

    def write(self, path):
        xmlversion = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'
        doctype = '<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML {} Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">\n'.format(
            self.version)

        try:
            if path[-4:] != '.xml':
                path += '.xml'
        except TypeError:
            pass
        output_file = open(path, 'w')
        output_file.write(xmlversion)
        output_file.write(doctype)
        output_file.write(self.to_string())
        output_file.close()
Exemplo n.º 14
0
class ComplexTypeStaffLayout(ComplexType):
    """
    Staff layout includes the vertical distance from the bottom line of the previous staff in this system to the top
    line of the staff specified by the number attribute. The optional number attribute refers to staff numbers within
    the part, from top to bottom on the system. A value of 1 is assumed if not present. When used in the defaults
    element, the values apply to all parts. This value is ignored for the first staff in a system.
    """
    _DTD = Sequence(Element(StaffDistance, min_occurrence=0))

    def __init__(self, tag, number=None, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)
        self.number = number

    @property
    def number(self):
        return self.get_attribute('number')

    @number.setter
    def number(self, value):
        if value is None:
            self.remove_attribute('number')
        else:
            TypeStaffNumber(value)
            self._ATTRIBUTES.insert(0, 'number')
            self.set_attribute('number', value)
Exemplo n.º 15
0
class ComplexTypePlay(ComplexType, Id):
    """The play type, new in Version 3.0, specifies playback techniques to be used in conjunction with the
    instrument-sound element. When used as part of a sound element, it applies to all notes going forward in score
    order. In multi-instrument parts, the affected instrument should be specified using the id attribute. When used as
    part of a note element, it applies to the current note only."""

    _DTD = Sequence(
        Choice(Element(Ipa),
               Element(Mute),
               Element(SemiPitched),
               Element(OtherPlay),
               min_occurrence=0,
               max_occurrence=None))

    def __init__(self, tag, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)
Exemplo n.º 16
0
class Foo(XMLElement):
    _DTD = Sequence(
        Choice(Sequence(GroupReference(TestGroup), Element(Duration)),
               Sequence(GroupReference(TestGroup), )))

    def __init__(self, *args, **kwargs):
        super().__init__(tag='foo', *args, **kwargs)
Exemplo n.º 17
0
class ComplexTypeClef(ComplexType, PrintStyle, PrintObject, OptionalUniqueId,
                      Additional, Size, AfterBarline):
    """
    Clefs are represented by a combination of sign, line, and clef-octave-change elements. The optional number attribute
    refers to staff numbers within the part. A value of 1 is assumed if not present. Sometimes clefs are added to the
    staff in non-standard line positions, either to indicate cue passages, or when there are multiple clefs present
    simultaneously on one staff. In this situation, the additional attribute is set to "yes" and the line value is
    ignored. The size attribute is used for clefs where the additional attribute is "yes". It is typically used to
    indicate cue clefs.

    Sometimes clefs at the start of a measure need to appear after the barline rather than before, as for cues or for
    use after a repeated section. The after-barline attribute is set to "yes" in this situation. The attribute is
    ignored for mid-measure clefs.

    Clefs appear at the start of each system unless the print-object attribute has been set to "no" or the additional
    attribute has been set to "yes".
    """
    '''
            <xs:attribute name="number" type="staff-number"/>
        <xs:attribute name="additional" type="yes-no"/>
        <xs:attribute name="size" type="symbol-size"/>
        <xs:attribute name="after-barline" type="yes-no"/>
        <xs:attributeGroup ref="print-style"/>
        <xs:attributeGroup ref="print-object"/>
        <xs:attributeGroup ref="optional-unique-id"/>'''
    _DTD = Sequence(Element(Sign), Element(Line, min_occurrence=0),
                    Element(ClefOctaveChange, min_occurrence=0))

    def __init__(self, tag, number=None, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)
        self.number = number

    @property
    def number(self):
        try:
            return self.get_attribute('number')
        except KeyError:
            return None

    @number.setter
    def number(self, value):
        if value is None:
            self.remove_attribute('number')
        else:
            TypeStaffNumber(value)
            self._ATTRIBUTES.insert(0, 'number')
            self.set_attribute('number', value)
Exemplo n.º 18
0
class ComplexTypeSystemDividers(ComplexType):
    """The system-dividers element indicates the presence or absence of system dividers (also known as system
    separation marks) between systems displayed on the same page. Dividers on the left and right side of the page are
    controlled by the left-divider and right-divider elements respectively. The default vertical position is half the
    system-distance value from the top of the system that is below the divider. The default horizontal position is the
    left and right system margin, respectively.

    When used in the print element, the system-dividers element affects the dividers that would appear between the
    current system and the previous system."""

    _DTD = Sequence(
        Element(LeftDivider),
        Element(RightDivider),
    ),

    def __init__(self, tag, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)
Exemplo n.º 19
0
class ComplexTypeBarline(ComplexType, BarlineAttributes):
    """
    If a barline is other than a normal single barline, it should be represented by a barline type that describes it.
    This includes information about repeats and multiple endings, as well as line style. Barline data is on the same
    level as the other musical data in a score - a child of a measure in a partwise score, or a part in a timewise
    score. This allows for barlines within measures, as in dotted barlines that subdivide measures in complex meters.
    The two fermata elements allow for fermatas on both sides of the barline (the lower one inverted).

    Barlines have a location attribute to make it easier to process barlines independently of the other musical data in
    a score. It is often easier to set up measures separately from entering notes. The location attribute must match
    where the barline element occurs within the rest of the musical data in the score. If location is left, it should be
    the first element in the measure, aside from the print, bookmark, and link elements. If location is right, it should
    be the last element, again with the possible exception of the print, bookmark, and link elements. If no location is
    specified, the right barline is the default. The segno, coda, and divisions attributes work the same way as in the
    sound element. They are used for playback when barline elements contain segno or coda child elements.
    """
    _DTD = Sequence(
        Element(BarStyle, min_occurrence=0),
        GroupReference(Editorial),
        Element(WavyLine, min_occurrence=0),
        Element(Segno, min_occurrence=0),
        Element(Coda, min_occurrence=0),
        Element(Fermata, min_occurrence=0, max_occurrence=2),
        Element(Ending, min_occurrence=0),
        Element(Repeat, min_occurrence=0)
    )

    def __init__(self, *args, **kwargs):
        super().__init__(tag='barline', *args, **kwargs)
Exemplo n.º 20
0
class ComplexTypePrint(ComplexType, PrintAttributes, OptionalUniqueId):
    """
    The print type 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.

    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.
    """
    _DTD = Sequence(GroupReference(Layout),
                    Element(MeasureLayout, min_occurrence=0),
                    Element(MeasureNumbering, min_occurrence=0),
                    Element(PartNameDisplay, min_occurrence=0),
                    Element(PartAbbreviationDisplay, min_occurrence=0))

    def __init__(self, tag, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)
Exemplo n.º 21
0
class Time(XMLElement, PrintObject, OptionalUniqueId):
    """
    Time signatures are represented by the beats element for the numerator and the beat-type element for the
    denominator. The symbol attribute is used indicate common and cut time symbols as well as a single number display.
    Multiple pairs of beat and beat-type elements are used for composite time signatures with multiple denominators,
    such as 2/4 + 3/8. A composite such as 3+2/8 requires only one beat/beat-type pair.
    The print-object attribute allows a time signature to be specified but not printed, as is the case for excerpts
    from the middle of a score. The value is "yes" if not present. The optional number attribute refers to staff numbers
    within the part. If absent, the time signature applies to all staves in the part.
    """

    _DTD = Choice(
        Sequence(GroupReference(TimeSignature, max_occurrence=None),
                 Element(Interchangeable, min_occurrence=0)),
        Element(SenzaMisura))

    def __init__(self, *args, **kwargs):
        super().__init__(tag='time', *args, **kwargs)
Exemplo n.º 22
0
class ComplexTypeEncoding(ComplexType):
    """
    The encoding element contains information about who did the digital encoding, when, with what software, and in what
     aspects. Standard type values for the encoder element are music, words, and arrangement, but other types may be
     used. The type attribute is only needed when there are multiple encoder element.
    """
    _DTD = Choice(
        Element(EncodingDate),
        Element(Encoder),
        Element(Software),
        Element(EncodingDescription),
        Element(Supports),
        min_occurrence=0,
        max_occurrence=None,
    )

    def __init__(self, tag, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)
Exemplo n.º 23
0
class ComplexTypeDirection(ComplexType, Placement, Directive,
                           OptionalUniqueId):
    """A direction is a musical indication that is not necessarily attached to a specific note. Two or more may be
    combined to indicate starts and stops of wedges, dashes, etc. For applications where a specific direction is indeed
    attached to a specific note, the direction element can be associated with the note element that follows it in score
    order that is not in a different voice.

    By default, a series of direction-type elements and a series of child elements of a direction-type within a single
    direction element follow one another in sequence visually. For a series of direction-type children, non-positional
    formatting attributes are carried over from the previous element by default."""

    _DTD = Sequence(Element(DirectionType, max_occurrence=None),
                    Element(Offset, min_occurrence=0),
                    GroupReference(EditorialVoiceDirection),
                    GroupReference(Staff, min_occurrence=0),
                    Element(Sound, min_occurrence=0))

    def __init__(self, tag, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)
Exemplo n.º 24
0
class ComplexTypeTimeModification(ComplexType):
    """
    Time modification indicates tuplets, double-note tremolos, and other durational changes. A time-modification element
    shows how the cumulative, sounding effect of tuplets and double-note tremolos compare to the written note type
    represented by the type and dot elements. Nested tuplets and other notations that use more detailed information need
    both the time-modification and tuplet elements to be represented accurately.
    """
    _DTD = Sequence(
        Element(ActualNotes),
        Element(NormalNotes),
        Sequence(
            Element(NormalType),
            Element(NormalDot, min_occurrence=0, max_occurrence=None),
            min_occurrence=0
        )
    )

    def __init__(self, *args, **kwargs):
        super().__init__(tag='time-modification', *args, **kwargs)
Exemplo n.º 25
0
class Pitch(Event):
    """
    Pitch is represented as a combination of the step of the diatonic scale, the chromatic alteration, and the octave.
    """
    _DTD = Sequence(Element(Step), Element(Alter, min_occurrence=0),
                    Element(Octave))

    def __init__(self, step=Step('C'), alter=None, octave=Octave(4)):
        super().__init__(tag='pitch')
        self._step = None
        self.step = step
        self.alter = alter
        self._octave = None
        self.octave = octave

    @property
    def step(self):
        return self._step

    @step.setter
    def step(self, value):
        self._set_child(Step, 'step', value)

    @property
    def alter(self):
        alter = self.get_children_by_type(Alter)
        if alter:
            return alter[0]
        else:
            return None

    @alter.setter
    def alter(self, value):
        self._set_child(Alter, 'alter', value)

    @property
    def octave(self):
        return self._octave

    @octave.setter
    def octave(self, value):
        self._set_child(Octave, 'octave', value)
Exemplo n.º 26
0
class ComplexTypeBackup(ComplexType):
    """
    The backup and forward elements are required to coordinate multiple voices in one part, including music on multiple
    staves. The backup type is generally used to move between voices and staves. Thus the backup element does not
    include voice or staff elements. Duration values should always be positive, and should not cross measure boundaries
    or mid-measure changes in the divisions value.
    """
    _DTD = Sequence(Element(Duration), GroupReference(Editorial))

    def __init__(self, tag, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)
Exemplo n.º 27
0
class ComplexTypeSystemLayout(ComplexType):
    """A system is a group of staves that are read and played simultaneously. System layout includes left and right
    margins and the vertical distance from the previous system. The system distance is measured from the bottom line
    of the previous system to the top line of the current system. It is ignored for the first system on a page. The top
    system distance is measured from the page's top margin to the top line of the first system. It is ignored for all
    but the first system on a page.

    Sometimes the sum of measure widths in a system may not equal the system width specified by the layout elements due
    to roundoff or other errors. The behavior when reading MusicXML files in these cases is application-dependent. For
    instance, applications may find that the system layout data is more reliable than the sum of the measure widths,
    and adjust the measure widths accordingly."""

    _DTD = Sequence(
        Element(SystemMargins, min_occurrence=0),
        Element(SystemDistance, min_occurrence=0),
        Element(TopSystemDistance, min_occurrence=0),
        Element(SystemDividers, min_occurrence=0),
    )

    def __init__(self, tag, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)
Exemplo n.º 28
0
class ComplexTypePartGroup(ComplexType):
    """
    The part-group element indicates groupings of parts in the score, usually indicated by braces and brackets. Braces
    that are used for multi-staff parts should be defined in the attributes element for that part. The part-group start
    element appears before the first score-part in the group. The part-group stop element appears after the last
    score-part in the group.

    The number attribute is used to distinguish overlapping and nested part-groups, not the sequence of groups. As with
    parts, groups can have a name and abbreviation. Values for the child elements are ignored at the stop of a group.

    A part-group element is not needed for a single multi-staff part. By default, multi-staff parts include a brace
    symbol and (if appropriate given the bar-style) common barlines. The symbol formatting for a multi-staff part can
    be more fully specified using the part-symbol element.
    """
    _DTD = Sequence(Element(GroupName, min_occurrence=0),
                    Element(GroupNameDisplay, min_occurrence=0),
                    Element(GroupAbbreviation, min_occurrence=0),
                    Element(GroupAbbreviationDisplay, min_occurrence=0),
                    Element(GroupSymbol, min_occurrence=0),
                    Element(GroupBarline, min_occurrence=0),
                    Element(GroupTime, min_occurrence=0),
                    GroupReference(Editorial))
    _ATTRIBUTES = []

    def __init__(self, type, number='1', *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.type = type
        self.number = number

    @property
    def number(self):
        return self.get_attribute('number')

    @number.setter
    def number(self, value):
        if value is None:
            self.remove_attribute('number')
        else:
            Token(value)
            self._ATTRIBUTES.insert(0, 'number')
            self.set_attribute('number', value)

    @property
    def type(self):
        return self.get_attribute('type')

    @type.setter
    def type(self, value):
        if value is None:
            self.remove_attribute('type')
        else:
            TypeStartStop(value)
            self._ATTRIBUTES.insert(0, 'type')
            self.set_attribute('type', value)
Exemplo n.º 29
0
class ComplexTypeDefaults(ComplexType):
    """
    The defaults type specifies score-wide defaults for scaling, layout, and appearance.
    """
    def __init__(self, tag, *args, **kwargs):
        super().__init__(tag=tag, *args, **kwargs)

    _DTD = Sequence(Element(Scaling, min_occurrence=0), GroupReference(Layout),
                    Element(Appearance, 0), Element(MusicFont, 0),
                    Element(WordFont, 0), Element(LyricFont, 0, None),
                    Element(LyricLanguage, 0, None))
Exemplo n.º 30
0
class ComplexTypeScorePart(ComplexType, Id):
    """
    Each MusicXML part corresponds to a track in a Standard MIDI Format 1 file. The score-instrument elements are used
    when there are multiple instruments per track. The midi-device element is used to make a MIDI device or port
    assignment for the given track or specific MIDI instruments. Initial midi-instrument assignments may be made here
    as well.
    """

    _DTD = Sequence(
        Element(Identification, min_occurrence=0), Element(PartName),
        Element(PartNameDisplay, min_occurrence=0),
        Element(PartAbbreviation, min_occurrence=0),
        Element(PartAbbreviationDisplay, min_occurrence=0),
        Element(Group, min_occurrence=0, max_occurrence=None),
        Element(ScoreInstrument, min_occurrence=0, max_occurrence=None),
        Sequence(Element(MidiDevice, min_occurrence=0),
                 Element(MidiInstrument, min_occurrence=0),
                 min_occurrence=0,
                 max_occurrence=None))

    def __init__(self, tag, id, *args, **kwargs):
        super().__init__(tag=tag, id=id, *args, **kwargs)