This module provides object representations of expressions, that is notational symbols such as Fermatas, Mordents, Trills, Turns, etc. which are stored under a Music21Object’s .expressions attribute
given a Music21Object with Ornament expressions, convert them into a list of objects that represents the performed version of the object:
>>> from music21 import *
>>> n1 = note.Note("D5")
>>> n1.quarterLength = 1
>>> n1.expressions.append(expressions.WholeStepMordent())
>>> expList = expressions.realizeOrnaments(n1)
>>> st1 = stream.Stream()
>>> st1.append(expList)
>>> st1.show()
Inherits from: Music21Object, JSONSerializer
Inherits from: Expression, Music21Object, JSONSerializer
Fermatas by default get appended to the last note if a note is split because of measures. To override this (for Fermatas or for any expression) set .tieAttach to ‘all’ or ‘first’ instead of ‘last’.
>>> from music21 import *
>>> p1 = stream.Part()
>>> p1.append(meter.TimeSignature('6/8'))
>>> n1 = note.Note("D-2")
>>> n1.quarterLength = 6
>>> n1.expressions.append(expressions.Fermata())
>>> p1.append(n1)
>>> p1.show()
Fermata attributes
Attributes without Documentation: lily, shape, tieAttach, type
Attributes inherited from Music21Object: classSortOrder, id, groups
Fermata properties
- mx¶
Advanced feature: As a getter gives the music21.musicxml object for the Fermata or as a setter changes the current fermata to have the characteristics of the musicxml object to fit this type:
>>> from music21 import * >>> a = Fermata() >>> mxFermata = a.mx >>> mxFermata.get('type') 'upright'>>> mxFermata2 = musicxml.Fermata() >>> mxFermata2.set('type', 'upright-inverted') >>> a.mx = mxFermata2 >>> a.type 'upright-inverted'Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, duration, measureNumberLocal, offset, priority
Properties inherited from JSONSerializer: json
Fermata methods
Methods inherited from Music21Object: searchParentByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndParent(), freezeIds(), getAllContextsByClass(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), hasContext(), isClass(), mergeAttributes(), purgeLocations(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), show(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()
Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()
Inherits from: Ornament, Expression, Music21Object, JSONSerializer
GeneralMordent attributes
Attributes without Documentation: direction, quarterLength, size
Attributes inherited from Ornament: connectedToPrevious, tieAttach
Attributes inherited from Music21Object: classSortOrder, id
GeneralMordent properties
Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, duration, measureNumberLocal, offset, priority
Properties inherited from JSONSerializer: json
GeneralMordent methods
- realize(srcObject)¶
- realize a mordent.
Methods inherited from Music21Object: searchParentByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndParent(), freezeIds(), getAllContextsByClass(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), hasContext(), isClass(), mergeAttributes(), purgeLocations(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), show(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()
Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()
Inherits from: InvertedMordent, GeneralMordent, Ornament, Expression, Music21Object, JSONSerializer
Inherits from: Mordent, GeneralMordent, Ornament, Expression, Music21Object, JSONSerializer
Inherits from: Trill, Ornament, Expression, Music21Object, JSONSerializer
Inherits from: GeneralMordent, Ornament, Expression, Music21Object, JSONSerializer
Inherits from: Ornament, Expression, Music21Object, JSONSerializer
Inherits from: GeneralMordent, Ornament, Expression, Music21Object, JSONSerializer
Inherits from: Expression, Music21Object, JSONSerializer
Ornament attributes
Attributes without Documentation: connectedToPrevious, tieAttach
Attributes inherited from Music21Object: classSortOrder, id, groups
Ornament properties
Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, duration, measureNumberLocal, offset, priority
Properties inherited from JSONSerializer: json
Ornament methods
- realize(sourceObject)¶
- subclassible method call that takes a sourceObject and returns a three-element tuple of a list of notes before the “main note”, the “main note” itself, and a list of notes after the “main note”.
Methods inherited from Music21Object: searchParentByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndParent(), freezeIds(), getAllContextsByClass(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), hasContext(), isClass(), mergeAttributes(), purgeLocations(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), show(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()
Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()
Inherits from: Ornament, Expression, Music21Object, JSONSerializer
Trill attributes
- size¶
- A GenericInterval is an interval such as Third, Seventh, Octave, or Tenth. Constructor takes an integer or string specifying the interval and direction. The interval is not specified in half-steps, but in numeric values derived from interval names: a Third is 3; a Seventh is 7, etc. String values for interval names (‘3rd’ or ‘third’) are accepted. staffDistance: the number of lines or spaces apart, eg: E.g. C4 to C4 = 0; C4 to D4 = 1; C4 to B3 = -1
Attributes without Documentation: nachschlag, placement, tieAttach
Attributes inherited from Ornament: connectedToPrevious
Attributes inherited from Music21Object: classSortOrder, id
Trill properties
- mx¶
Returns a musicxml.TrillMark object
>>> a = Trill() >>> a.placement = 'above' >>> mxTrillMark = a.mx >>> mxTrillMark.get('placement') 'above'Properties inherited from Music21Object: activeSite, beat, beatDuration, beatStr, beatStrength, classes, duration, measureNumberLocal, offset, priority
Properties inherited from JSONSerializer: json
Trill methods
Methods inherited from Ornament: realize()
Methods inherited from Music21Object: searchParentByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndParent(), freezeIds(), getAllContextsByClass(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), hasContext(), isClass(), mergeAttributes(), purgeLocations(), removeLocationBySite(), removeLocationBySiteId(), setOffsetBySite(), show(), splitAtDurations(), splitAtQuarterLength(), splitByQuarterLengths(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()
Methods inherited from JSONSerializer: jsonAttributes(), jsonComponentFactory(), jsonPrint(), jsonRead(), jsonWrite()
Inherits from: Ornament, Expression, Music21Object, JSONSerializer
Inherits from: InvertedMordent, GeneralMordent, Ornament, Expression, Music21Object, JSONSerializer
Inherits from: Mordent, GeneralMordent, Ornament, Expression, Music21Object, JSONSerializer
Inherits from: Trill, Ornament, Expression, Music21Object, JSONSerializer