music21.alpha.medren¶
Tools for working with medieval and Renaissance music – see also the trecento directory which works particularly on 14th-century Italian music. Objects representing the punctus and the divisione can be found there.
Functions¶
-
music21.alpha.medren.
breakMensuralStreamIntoBrevisLengths
(inpStream, inpMOrD=None, printUpdates=False)¶ Takes a stream as an argument. Takes a mensuration or divisione object as an optional argument.
To work effectively, this stream must contain only mensural objects. The function
music21.medren.breakMensuralStreamIntoBrevisLengths()
takes the mensural stream, and returns a measured stream. This measured stream preserves the structure of the original stream. The mensural object present in the original stream are also present in the measured stream. Each brevis length worth of objects in the original are stored in the mensural stream as a mensural object.No substream of the original stream can contain both stream and mensural type objects, otherwise the stream cannot be processed.
Furthermore, no stream can contain higher hierarchy stream types. The stream type hierarchy is
music21.stream.Stream
, followed bymusic21.stream.Score
,music21.stream.Part
, thenmusic21.stream.Measure
.Finally, a mensuration or divisione must be present or determinable, otherwise the stream cannot be converted. If multiple mensurations are present, they must change only at the highest stream instance.
Otherwise, this causes a inconsistency when converting the stream.
>>> from music21.alpha import medren
>>> s = stream.Score() >>> p = stream.Part() >>> m = stream.Measure() >>> s.append(p) >>> s.append(medren.GeneralMensuralNote('B')) >>> medren.breakMensuralStreamIntoBrevisLengths(s) Traceback (most recent call last): MedRenException: cannot combine objects of type <class 'music21.stream.Part'>, <class 'music21.alpha.medren.GeneralMensuralNote'> within stream
>>> s = stream.Score() >>> p.append(s) >>> medren.breakMensuralStreamIntoBrevisLengths(p) Traceback (most recent call last): MedRenException: Hierarchy of <class 'music21.stream.Part'> violated by <class 'music21.stream.Score'>
>>> from music21.alpha import trecento >>> p = stream.Part() >>> m.append(medren.MensuralNote('G','B')) >>> p.append(trecento.notation.Divisione('.q.')) >>> p.repeatAppend(medren.MensuralNote('A','SB'),2) >>> p.append(trecento.notation.Punctus()) >>> p.repeatAppend(medren.MensuralNote('B','M'),4) >>> p.append(trecento.notation.Punctus()) >>> p.append(medren.MensuralNote('C','B')) >>> s.append(trecento.notation.Divisione('.p.')) >>> s.append(p) >>> s.append(m) >>> medren.breakMensuralStreamIntoBrevisLengths(s, printUpdates = True) Traceback (most recent call last): MedRenException: Mensuration or divisione <music21.alpha.trecento.notation.Divisione .q.> not consistent within hierarchy
>>> s = stream.Stream() >>> s.append(trecento.notation.Divisione('.q.')) >>> s.append(p) >>> s.append(m) >>> t = medren.breakMensuralStreamIntoBrevisLengths(s, printUpdates = True) Getting measure 0... ... >>> t.show('text') {0.0} <music21.alpha.trecento.notation.Divisione .q.> {0.0} <music21.stream.Part...> {0.0} <music21.stream.Measure...> {0.0} <music21.medren.MensuralNote semibrevis A> {0.0} <music21.medren.MensuralNote semibrevis A> {0.0} <music21.stream.Measure...> {0.0} <music21.medren.MensuralNote minima B> {0.0} <music21.medren.MensuralNote minima B> {0.0} <music21.medren.MensuralNote minima B> {0.0} <music21.medren.MensuralNote minima B> {0.0} <music21.stream.Measure...> {0.0} <music21.medren.MensuralNote brevis C> {0.0} <music21.stream.Measure...> {0.0} <music21.medren.MensuralNote brevis G>
-
music21.alpha.medren.
convertHouseStyle
(score, durationScale=2, barlineStyle='tick', tieTransfer=True, inPlace=False)¶ The method
music21.medren.convertHouseStyle()
takes a score, durationScale, barlineStyle, tieTransfer, and inPlace as arguments. Of these, only score is not optional.Default values for durationScale, barlineStyle, tieTransfer, and inPlace are 2, ‘tick’, True, and False respectively.
Changing
music21.medren.convertHouseStyle.barlineStyle
changes how the barlines are displayed within the piece.Changing
music21.medren.convertHouseStyle.durationScale
keeps ratios of note durations constant, but scales each duration by the specified value.If changing the duration scale causes tied notes, and
music21.medren.convertHouseStyle.tieTransfer
is set to True, the total duration is transferred to the first note, and all remaining space is left blank.Examples: The first image shows the original score. The second image shows the score with each note’s duration scaled by 2, and with the barline style set to ‘tick’. The circled area shows a space left blank due to tieTransfer being True.
>>> gloria = corpus.parse('luca/gloria')
>>> from music21.alpha import medren
>>> gloria = corpus.parse('luca/gloria') >>> newGloria = medren.convertHouseStyle(gloria, durationScale=2, ... barlineStyle='tick', tieTransfer=True)
-
music21.alpha.medren.
cummingSchubertStrettoFuga
(score)¶ evaluates how well a given score works as a Stretto fuga would work at different intervals
-
music21.alpha.medren.
scaleDurations
(score, scalingNum=1, inPlace=False, scaleUnlinked=True)¶ scale all notes and TimeSignatures by the scaling amount.
returns the Score object
-
music21.alpha.medren.
setBarlineStyle
(score, newStyle, oldStyle='regular', inPlace=True)¶ Converts any right barlines in the previous style (oldStyle; default = ‘regular’) to have the newStyle (such as ‘tick’, ‘none’, etc., see bar.py).
Leaves alone any other barline types (such as double bars, final bars, etc.). Also changes any measures with no specified barlines (which come out as ‘regular’) to have the new style.
returns the Score object.
-
music21.alpha.medren.
testStretto
()¶
-
music21.alpha.medren.
transferTies
(score, inPlace=True)¶ transfer the duration of tied notes (if possible) to the first note and fill the remaining places with invisible rests:
returns the new Score object
GeneralMensuralNote¶
-
class
music21.alpha.medren.
GeneralMensuralNote
(mensuralTypeOrAbbr='brevis')¶ The base class object for
music21.medren.MensuralNote
andmusic21.medren.MensuralRest
. This is arguably the most important mensural object, since it is responsible for getting the context and determining the contextual duration of objects within both subclasses. Amusic21.medren.GeneralMensuralNote
object takes a mensural type or its abbreviation as an argument. The default value for this argument is ‘brevis’.Valid mensural types are ‘maxima’, ‘longa’, ‘brevis’, ‘semibrevis’, ‘minima’, and ‘semiminima’. The corresponding abbreviations are ‘Mx’, ‘L’, ‘B’, ‘SB’, ‘M’, and ‘SM’.
The object’s mensural type can be set and accessed via the property
music21.medren.GeneralMensuralNote.mensuralType
. The duration of a general mensural note can be set and accessed using the propertymusic21.medren.GeneralMensuralNote.duration
. If the duration of an general mensural note cannot be determined from context, it is set to 0. For more specific examples of this, please see themusic21.medren.GeneralMensuralNote.duration
documentation.Two general mensural notes are considered equal if they have the same mensural type, are present in the same context, and have the same offset within that context.
GeneralMensuralNote
bases
GeneralMensuralNote
read-only properties
Read-only properties inherited from Music21Object
:
GeneralMensuralNote
read/write properties
-
GeneralMensuralNote.
mensuralType
¶ Name of the mensural length of the general mensural note (brevis, longa, etc.):
>>> from music21.alpha import medren
>>> gmn = medren.GeneralMensuralNote('maxima') >>> gmn.mensuralType 'maxima' >>> gmn_1 = medren.GeneralMensuralNote('SB') >>> gmn_1.mensuralType 'semibrevis' >>> gmn_2 = medren.GeneralMensuralNote('blah') Traceback (most recent call last): MedRenException: blah is not a valid mensural type or abbreviation
Read/write properties inherited from Music21Object
:
GeneralMensuralNote
methods
-
GeneralMensuralNote.
updateDurationFromMensuration
(mensuration=None, surroundingStream=None)¶ The duration of a
music21.medren.GeneralMensuralNote
object can be accessed and set using themusic21.medren.GeneralMensuralNote.duration
property. The duration of a general mensural note is by default 0. If the object’s subclass is not specified (music21.medren.MensuralNote
ormusic21.medren.MensuralRest
), the duration will remain 0 unless set to some other value. If a general mensural note has no context, the duration will remain 0 since duration is context dependant. Finally, if a mensural note or a mensural rest has context, but a mensuration or divisione cannot be found or determined from that context, the duration will remain 0.Every time a duration is changed, the method
music21.medren.GeneralMensuralNote.updateDurationFromMensuration`()
should be called.>>> from music21.alpha import medren
>>> mn = medren.GeneralMensuralNote('B') >>> mn.duration.quarterLength 0.0 >>> mn = medren.MensuralNote('A', 'B') >>> mn.duration.quarterLength 0.0
However, if subclass is given, context (a stream) is given, and a mensuration or divisione is given, duration can be determined.
>>> from music21.alpha import medren >>> from music21.alpha import trecento
>>> s = stream.Stream() >>> s.append(trecento.notation.Divisione('.p.')) >>> for i in range(3): ... s.append(medren.MensuralNote('A', 'SB')) >>> s.append(trecento.notation.Punctus()) >>> s.append(medren.MensuralNote('B', 'SB')) >>> s.append(medren.MensuralNote('B', 'SB')) >>> s.append(trecento.notation.Punctus()) >>> s.append(medren.MensuralNote('A', 'B')) >>> for mn in s: ... if isinstance(mn, medren.GeneralMensuralNote): ... mn.updateDurationFromMensuration(surroundingStream=s) ... print(mn.duration.quarterLength) 1.0 1.0 1.0 1.0 2.0 3.0
Note: French notation not yet supported.
Methods inherited from Music21Object
:
GeneralMensuralNote
instance variables
Instance variables inherited from Music21Object
:
Ligature¶
-
class
music21.alpha.medren.
Ligature
(pitches=None, color='black', filled='yes')¶ An object that represents a ligature commonly found in medieval and Renaissance music. Initialization takes a list of the pitches in the ligature as a required argument. Color of the ligature is an optional argument (default is ‘black’). Color can also be set with the
music21.medren.Ligature.setColor()
method. Color of a ligature can be determined with themusic21.medren.Ligature.getColor()
method. Whether the noteheads of the ligature are filled is an optional argument (default is ‘yes’). Noteheads can be also filled with themusic21.medren.Ligature.setFillStatus()
method. Fill status of a ligature can be determined with themusic21.medren.Ligature.getFillStatus()
method.The notes of the ligature can be accessed via the property
music21.medren.Ligature.notes
. The mensural length of each note is calculated automatically. To determine if a ligature is cum proprietate, use themusic21.medren.Ligature.isCumProprietate()
method. Similarly, to determine if a ligautre is cum perfectione, use themusic21.medren.Ligature.isCumPerfectione()
method. Finally, to determine if a ligature is cum opposita proprietate (C.O.P), use themusic21.medren.Ligature.isCOP()
method.Noteheads can be set to have oblique shape using the
music21.medren.Ligature.makeOblique()
method. Similarly, oblique noteheads can be set to have a square shape using themusic21.medren.Ligature.makeSquare()
method. The shape of a notehead can be determined using themusic21.medren.Ligature.getNoteheadShape()
method. By default, all noteheads in a ligature are square.A note in the ligature can be made to be maxima by the
music21.medren.Ligature.setMaxima()
method. It can be determined whether a note is a maxima by themusic21.medren.Ligature.isMaxima()
method. By default, no notes in a ligature are maxima.A note in the ligature can be set to have an upstem, a downstem, or no stem by the
music21.medren.Ligature.setStem()
method. It can be determined whether a note has a stem by themusic21.medren.Ligature.getStem()
method. By default, no notes in a ligature have stems.A note in the ligature can be ‘reversed’ by the music21.medren.Ligature.setReverse method. A ‘reversed’ note is displayed as stacked upon the preceding note (see the second note in the example). It can be determined whether a note is reversed by the music21.medren.Ligature.isReversed method. By default, no notes in a ligature are reversed. ——————————————————–
Example:
Roman de Fauvel. f. 1r. Paris, Bibliothèque Nationale de France, MS fr.
The ligatures outlined in blue would be constructed as follows:
>>> from music21.alpha import medren
>>> l1 = medren.Ligature(['A4','F4','G4','A4','B-4']) >>> l1.makeOblique(0) >>> l1.setStem(0, 'down', 'left') >>> print([n.fullName for n in l1.notes]) ['brevis A in octave 4 ', 'brevis F in octave 4 ', 'brevis G in octave 4 ', 'brevis A in octave 4 ', 'brevis B-flat in octave 4 '] >>> >>> l2 = medren.Ligature(['F4','G4','A4','B-4','D5']) >>> l2.setStem(4, 'down', 'left') >>> l2.setReverse(4, True) >>> print([(n.mensuralType, n.pitch.nameWithOctave) for n in l2.notes]) [('brevis', 'F4'), ('brevis', 'G4'), ('brevis', 'A4'), ('brevis', 'B-4'), ('longa', 'D5')]
Note that ligatures cannot be displayed yet.
Ligature
bases
Ligature
read-only properties
-
Ligature.
notes
¶ Returns the ligature as a list of mensural notes
>>> from music21.alpha import medren
>>> l = medren.Ligature(['A4','B4']) >>> print([n.mensuralType for n in l.notes]) ['brevis', 'brevis'] >>> l.makeOblique(0) >>> print([n.mensuralType for n in l.notes]) ['longa', 'brevis'] >>> l = medren.Ligature(['B4','A4']) >>> print([n.mensuralType for n in l.notes]) ['longa', 'longa'] >>> l.makeOblique(0) >>> print([n.mensuralType for n in l.notes]) ['longa', 'brevis'] >>> l.setStem(0, 'down','left') >>> print([n.mensuralType for n in l.notes]) ['brevis', 'brevis'] >>> l = medren.Ligature(['G4','A4','B4','A4']) >>> l.setStem(2, 'up','left') >>> print([n.mensuralType for n in l.notes]) ['brevis', 'brevis', 'semibrevis', 'semibrevis'] >>> l = medren.Ligature(['B4','A4','G4','A4','G4','A4','F4']) >>> l.makeOblique(0) >>> l.makeOblique(4) >>> l.setStem(2, 'down', 'left') >>> l.setStem(4, 'up','left') >>> l.setMaxima(6, True) >>> print([n.mensuralType for n in l.notes]) ['longa', 'brevis', 'longa', 'brevis', 'semibrevis', 'semibrevis', 'maxima']
Read-only properties inherited from Music21Object
:
Ligature
read/write properties
-
Ligature.
pitches
¶ A list of pitches comprising the ligature
Read/write properties inherited from Music21Object
:
Ligature
methods
-
Ligature.
getColor
(index=None)¶ Take one argument: index (optional, default is None).
Returns the color of the note at the given index. If no index specified, returns the color of the ligature. If multiple colors are present, returns mixed.
-
Ligature.
getFillStatus
(index=None)¶ Take one argument: index (optional, default is None).
Returns whether the notehead is filled at the given index. If no index specified, returns whether fill status of the ligature. If noteheads are not consistent throughout the ligature, returns mixed.
-
Ligature.
getNoteheadShape
(index)¶ Takes one argument: index.
Returns the notehead shape (either square or oblique) of the note at index
-
Ligature.
getStem
(index)¶ Takes one argument: index If the note at index has a stem, it returns direction (up or down) and orientation (left, right)
-
Ligature.
isCOP
()¶ Takes no arguments
Returns True if the ligature is cum opposita proprietate (C.O.P), and False otherwise
-
Ligature.
isCumPerfectione
()¶ Takes no arguments.
Returns True if the ligature is cum perfectione, and False if the ligature is sine perfectione.
-
Ligature.
isCumProprietate
()¶ Takes no arguments.
Returns True if the ligature is cum proprietate, and False if the ligature is sine proprietate.
-
Ligature.
isMaxima
(index)¶ Takes one argument: index.
If the note at index is a maxima, returns True. Otherwise, it returns False.
-
Ligature.
isReversed
(index)¶ Takes one argument: index.
If the note at index is reversed, returns True. Otherwise, it returns False.
-
Ligature.
makeOblique
(startIndex)¶ Takes one argument: startIndex.
Make the notes at startIndex and the note following startIndex into an oblique notehead. Note that an oblique notehead cannot start on the last note of a ligature. Also, a note that is a maxima cannot be the start or end of an oblique notehead.
>>> from music21.alpha import medren
>>> l = medren.Ligature(['A4','C5','B4','A4']) >>> l.makeOblique(1) >>> l.getNoteheadShape(1) 'oblique' >>> l.getNoteheadShape(2) 'oblique' >>> l.makeOblique(0) Traceback (most recent call last): MedRenException: cannot start oblique notehead at index 0 >>> l.makeOblique(2) Traceback (most recent call last): MedRenException: cannot start oblique notehead at index 2 >>> l.makeOblique(3) Traceback (most recent call last): MedRenException: no note exists at index 4
-
Ligature.
makeSquare
(index)¶ Takes one argument: index.
Sets the note at index to have a square notehead. If the note at index is part of an oblique notehead, all other notes that are part of that notehead are also set to have square noteheads.
>>> from music21.alpha import medren
>>> l = medren.Ligature(['A4','C5','B4','A4']) >>> l.makeOblique(1) >>> l.makeSquare(2) >>> l.getNoteheadShape(2) 'square' >>> l.getNoteheadShape(1) 'square'
-
Ligature.
setColor
(value, index=None)¶ Takes two arguments: value, index (optional, default is None).
Sets the color of note at index to value. If no index is specified, or index is set to None, every note in the ligature is given value as a color.
>>> from music21.alpha import medren
>>> l = medren.Ligature(['A4','C5','B4']) >>> l.setColor('red') >>> l.getColor() 'red' >>> l.setColor('black',1) >>> l.getColor() 'mixed'
-
Ligature.
setFillStatus
(value, index=None)¶ Takes two arguments: value, index (optional, default is None).
Sets the fill status of the notehead at index to value. If no index is specified, or if index is set to None, every notehead is give fill status value. To set a notehead as filled, value should be ‘yes’ or ‘filled’. To set a notehead as empty, value should be ‘no’ or ‘empty’ .
>>> from music21.alpha import medren
>>> l = medren.Ligature(['A4','C5','B4']) >>> l.setFillStatus('filled') >>> l.getFillStatus() 'yes' >>> l.setFillStatus('no', 1) >>> l.getFillStatus() 'mixed'
-
Ligature.
setMaxima
(index, value)¶ Takes two arguments: index, value.
Sets the note at index to value. If value is True, that note is a maxima. If value if False, that note is not. A note with an oblique notehead cannot be a maxima. A note cannot be a maxima if that note has a stem. A note cannot be a maxima if the previous note has an up-stem.
>>> from music21.alpha import medren
>>> l = medren.Ligature(['A4','C5','B4']) >>> l.setStem(0, 'up', 'left') >>> l.setMaxima(2, True) >>> l.isMaxima(2) True >>> l.setMaxima(1, True) Traceback (most recent call last): MedRenException: cannot make note at index 1 a maxima >>> l.setMaxima(0, True) Traceback (most recent call last): MedRenException: cannot make note at index 0 a maxima >>> l.setMaxima(2, False) >>> l.isMaxima(2) False
-
Ligature.
setReverse
(endIndex, value)¶ Takes two arguments: endIndex, value.
endIndex designates the note to be reversed. value may be True or False. Setting value to True reverses the note at endIndex. Setting value to False ‘de-reverses’ the note at endIndex.
If the note at endIndex has a stem with direction ‘down’ and orientation ‘left’, and is at least a step above the preceding note, it can be reversed. No two consecutive notes can be reversed. Also, if the note at endIndex is preceded by a note with an upstem, it cannot be reversed.
A reversed note is displayed directly on top of the preceeding note in the ligature.
>>> from music21.alpha import medren
>>> l = medren.Ligature(['A4','C5','F5','F#5']) >>> l.setStem(1, 'down', 'left') >>> l.setStem(2, 'down', 'left') >>> l.setStem(3, 'down', 'left') >>> l.setReverse(1,True) >>> l.isReversed(1) True >>> l.setReverse(2,True) Traceback (most recent call last): MedRenException: the note at index 2 cannot be given reverse value True >>> l.setReverse(3,True) Traceback (most recent call last): MedRenException: the note at index 3 cannot be given reverse value True
-
Ligature.
setStem
(index, direction, orientation)¶ Takes three arguments: index, direction, orientation.
Index determines which note in the ligature the stem will be placed on. Direction determines which way the stem faces. Permitted directions are ‘up’,’down’, and ‘none’. Orientation determines on which side of the note the stem sits. Permitted orientations are ‘left’, ‘right’, and ‘none’. Setting the direction and orientation of a stem to ‘none’ removes the stem from the note.
Note that if the direction of a stem is ‘none’, then no stem is present on that note. So the orientation must also be ‘none’. Also note that an up-stem followed consecutively by a stemmed note is not permitted. An up-stem cannot be on the last note of a ligature. Stems may also not overlap. So two consecutive notes may note have stem orientations ‘right’ and ‘left’ respectively.
Finally, a stem cannot be set on a note that is a maxima. An up-stem cannot be set on a note preceding a maxima.
>>> from music21.alpha import medren
>>> l = medren.Ligature(['A4','C5','B4','A4','B4']) >>> l.setStem(0, 'none','left') Traceback (most recent call last): MedRenException: direction "None" and orientation "left" not supported for ligatures >>> l.setStem(1,'up', 'left') >>> l.getStem(1) ('up', 'left') >>> l.setStem(2, 'down', 'right') Traceback (most recent call last): MedRenException: a stem with direction "down" not permitted at index 2 >>> l.setMaxima(4, True) >>> l.setStem(4, 'up', 'left') Traceback (most recent call last): MedRenException: cannot place stem at index 4 >>> l.setStem(3, 'up','left') Traceback (most recent call last): MedRenException: a stem with direction "up" not permitted at index 3
Methods inherited from Music21Object
:
Ligature
instance variables
Instance variables inherited from Music21Object
:
MensuralClef¶
-
class
music21.alpha.medren.
MensuralClef
(sign='C')¶ An object representing a mensural clef found in medieval and Renaissance music.
>>> from music21.alpha import medren
>>> fclef = medren.MensuralClef('F') >>> fclef.line 3 >>> fclef.fontString '0x5c'
MensuralClef
bases
MensuralClef
read-only properties
-
MensuralClef.
fontString
¶ Returns the utf-8 code corresponding to the mensural clef in Ciconia font
Read-only properties inherited from Music21Object
:
MensuralClef
read/write properties
-
MensuralClef.
line
¶ The staff line the clef resides on
Read/write properties inherited from Music21Object
:
MensuralClef
methods
Methods inherited from Music21Object
:
MensuralClef
instance variables
Instance variables inherited from Music21Object
:
MensuralNote¶
-
class
music21.alpha.medren.
MensuralNote
(*arguments, **keywords)¶ An object representing a mensural note commonly found in medieval and renaissance music. Takes pitch and mensural type as arguments, but defaults to ‘C’ and ‘brevis’. Pitch and and mensural type can also be set using the properties
music21.medren.MensuralNote.pitch
andmusic21.medren.MensuralNote.mensuralType
respectively. The utf-8 code for the Ciconia font character can be accessed via the propertymusic21.medren.MensuralNote.fontString
The note stems can can be set using the method
music21.medren.MensuralNote.setStem()
. A note’s stems can be displayed using the methodmusic21.medren.MensuralNote.getStems()
. Stems may only be added to notes shorter than a brevis. For additional detail, see the documentation formusic21.medren.MensuralNote.setStem()
.The note flags can be set using the method
music21.medren.MensuralNote.setFlag()
. A note’s flags can be displayed using the methodmusic21.medren.MensuralNote.getFlags()
. Flags may only be added to stems that exist for the given note. For additional detail, see the documentation formusic21.medren.MensuralNote.setFlag()
.Two mensural notes are considered equal if they match in pitch, articulation, and are equal as general mensural notes.
Additional methods regarding color, duration, mensural type are inherited from
music21.medren.GeneralMensuralNote
.
MensuralNote
bases
MensuralNote
read-only properties
-
MensuralNote.
fontString
¶ The utf-8 code corresponding to a mensural note in Ciconia font. Note that semiminima with a left flag on the upper stem and any flag on the lower stem, semiminima with a right flag on the upperstem and on the lowerstem, and any red or unfilled notes with sidestems have no corresponding characters in the Cicionia font.
TODO: Replace with SMuFL
>>> from music21.alpha import medren
>>> mn = medren.MensuralNote('A', 'M') >>> mn.setStem('down') >>> mn.fontString '0x44' >>> mn.setFlag('down', 'right') >>> mn.fontString '0x47' >>> mn.setFlag('down', None) >>> mn.setStem(None) >>> mn.fontString '0x4d' >>> mn.color = 'red' >>> mn.fontString '0x6d'
-
MensuralNote.
fullName
¶
Read-only properties inherited from Note
:
Read-only properties inherited from Music21Object
:
MensuralNote
read/write properties
-
MensuralNote.
color
¶ The only valid colors for mensural notes are red and black
>>> from music21.alpha import medren
>>> n = medren.MensuralNote('A', 'brevis') >>> n.color >>> >>> n.color = 'red' >>> n.color 'red' >>> n.color = 'green' Traceback (most recent call last): MedRenException: color green not supported for mensural notes
-
MensuralNote.
mensuralType
¶ See documentation in music21.medren.GeneralMensuralType
Read/write properties inherited from Note
:
Read/write properties inherited from NotRest
:
Read/write properties inherited from GeneralNote
:
Read/write properties inherited from Music21Object
:
MensuralNote
methods
-
MensuralNote.
getFlags
()¶ Returns a dictionary of each stem with its corresponding flag.
-
MensuralNote.
getNumDots
()¶ Used for French notation. Not yet implemented
-
MensuralNote.
getStems
()¶ Returns a list of stem directions. If the note has no stem, returns an empty list
-
MensuralNote.
setFlag
(stemDirection, orientation)¶ Takes two arguments: stemDirection and orientation.
stemDirection may be ‘up’ or ‘down’ (sidestems cannot have flags), and orientation may be ‘left’ or ‘right’. If the note has a stem with direction stemDirection, a flag with the specified orientation is added. Any stem may only have up to one flag, so setting a flag overrides whatever flag was previously present. Setting the orientation of a flag to None returns that stem to its default flag setting (‘right’ for semiminima, None otherwise).
A minima may not have a flag on its upstem, while a semiminima always has a flag on its upstem. The flag orientation for a semiminima is ‘right’ by default, but may be set to ‘left’. Any note with a downstem may also have a flag on that stem.
>>> from music21.alpha import medren
>>> r_1 = medren.MensuralNote('A', 'minima') >>> r_1.setFlag('up', 'right') Traceback (most recent call last): MedRenException: a flag may not be added to an upstem of note type minima >>> r_1.setStem('down') >>> r_1.setFlag('down', 'left') >>> r_1.getFlags()['down'] 'left' >>> r_1.getFlags()['up'] is None True >>> r_2 = medren.MensuralNote('A', 'semiminima') >>> r_2.getFlags() {'up': 'right'} >>> r_2.setFlag('up', 'left') >>> r_2.getFlags() {'up': 'left'} >>> r_3 = medren.MensuralNote('A','semibrevis') >>> r_3.setStem('side') >>> r_3.setFlag('side','left') Traceback (most recent call last): MedRenException: a flag cannot be added to a stem with direction side
-
MensuralNote.
setStem
(direction)¶ Takes one argument: direction.
Adds a stem to a note. Any note with length less than or equal to a minima gets an upstem by default. Any note can have at most two stems. Valid stem directions are “down” and “side”. Downstems can be applied to any note with length less than or equal to a brevis. Side stems in Trecento notation are the equivalent of dots, but may only be applied to notes of the type semibrevis and minima (hence, a dotted note may not have a side stem, and vice versa). Setting stem direction to None removes all but the default number of stems.
>>> from music21.alpha import medren
>>> r_1 = medren.MensuralNote('A', 'brevis') >>> r_1.setStem('down') Traceback (most recent call last): MedRenException: A note of type brevis cannot be equipped with a stem >>> r_2 = medren.MensuralNote('A', 'semibrevis') >>> r_2.setStem('down') >>> r_2.setStem('side') >>> r_2.getStems() ['down', 'side'] >>> r_3 = medren.MensuralNote('A', 'minima') >>> r_3.setStem('side') >>> r_3.getStems() ['up', 'side'] >>> r_3.setStem('down') Traceback (most recent call last): MedRenException: This note already has the maximum number of stems >>> r_3.setStem(None) >>> r_3.getStems() ['up']
Methods inherited from GeneralMensuralNote
:
Methods inherited from Note
:
Methods inherited from GeneralNote
:
Methods inherited from Music21Object
:
MensuralNote
instance variables
Instance variables inherited from Note
:
Instance variables inherited from NotRest
:
Instance variables inherited from GeneralNote
:
Instance variables inherited from Music21Object
:
MensuralRest¶
-
class
music21.alpha.medren.
MensuralRest
(*arguments, **keywords)¶ An object representing a mensural rest. First argument is mensural type. The utf-8 code for the Ciconia font character can be accessed via the property
music21.medren.MensuralNote.fontString
Additional methods regarding color, duration, equality, and mensural type are inherited from
music21.medren.GeneralMensuralNote
.
MensuralRest
bases
MensuralRest
read-only properties
-
MensuralRest.
fontString
¶ The utf-8 code corresponding to the mensural rest in Ciconia font.
Note that there is no character for a semiminima rest yet.
TODO: Replace w/ SMuFL
>>> from music21.alpha import medren
>>> mr = medren.MensuralRest('SB') >>> mr.fontString '0x32'
-
MensuralRest.
fullName
¶
Read-only properties inherited from Music21Object
:
MensuralRest
read/write properties
Read/write properties inherited from GeneralMensuralNote
:
Read/write properties inherited from GeneralNote
:
Read/write properties inherited from Music21Object
:
MensuralRest
methods
Methods inherited from GeneralMensuralNote
:
Methods inherited from GeneralNote
:
Methods inherited from Music21Object
:
MensuralRest
instance variables
Instance variables inherited from Rest
:
Instance variables inherited from GeneralNote
:
Instance variables inherited from Music21Object
:
Mensuration¶
-
class
music21.alpha.medren.
Mensuration
(tempus='perfect', prolation='minor', mode='perfect', maximode=None, scalingFactor=4)¶ An object representing a mensuration sign found in French notation. Takes four optional arguments: tempus, prolation, mode, and maximode. Defaults are ‘perfect’, ‘minor’, ‘perfect’, and None respectively.
Valid values for tempus and mode are ‘perfect’ and ‘imperfect’. Valid values for prolation and maximode are ‘major’ and ‘minor’.
>>> from music21.alpha import medren
>>> ODot = medren.Mensuration(tempus = 'perfect', prolation = 'major') >>> ODot.standardSymbol 'O-dot' >>> ODot.fontString '0x50'
Mensuration
bases
Mensuration
read-only properties
-
Mensuration.
fontString
¶ The utf-8 code corresponding to the mensuration character in Ciconia font
TODO: Convert to SMuFL
>>> from music21.alpha import medren
>>> O = medren.Mensuration('imperfect', 'major') >>> O.fontString '0x4f'
Read-only properties inherited from TimeSignature
:
Read-only properties inherited from Music21Object
:
Mensuration
read/write properties
-
Mensuration.
minimaPerBrevis
¶ Used to get or set the number of minima in a ‘measure’ under the given mensuration.
>>> from music21.alpha import medren
>>> c = medren.Mensuration('imperfect', 'minor') >>> c.minimaPerBrevis 4 >>> c.minimaPerBrevis = 8 >>> c.minimaPerBrevis 8
Read/write properties inherited from TimeSignature
:
Read/write properties inherited from Music21Object
:
Mensuration
methods
Methods inherited from TimeSignature
:
Methods inherited from Music21Object
:
Mensuration
instance variables
Instance variables inherited from TimeSignature
:
Instance variables inherited from Music21Object
: