Converts a pitchString to a Pitch, only if necessary. This method is identical to the one in realizerScale.
>>> from music21.figuredBass import realizerScale
>>> pitchString = 'C5'
>>> realizerScale.convertToPitch(pitchString)
C5
>>> realizerScale.convertToPitch(pitch.Pitch('E4')) # does nothing
E4
Breaks apart and stores the information in a figured bass notation column, which is a string of figures, each associated with a number and an optional modifier. The figures are delimited using commas. Examples include “7,5,#3”, “6,4”, and “6,4+,2”.
Valid modifiers include those accepted by Accidental, such as #, -, and n, as well as those which can correspond to one, such as +, /, and b.
Note
If a figure has a modifier but no number, the number is assumed to be 3.
Notation also translates many forms of shorthand notation into longhand. It understands all the forms of shorthand notation listed below. This is true even if a number is accompanied by a modifier, or if a stand-alone modifier implies a 3.
Figures are saved in order from left to right as found in the notationColumn.
>>> from music21.figuredBass import notation
>>> n1 = notation.Notation("4+,2")
>>> n1.notationColumn
'4+,2'
>>> n1.figureStrings
['4+', '2']
>>> n1.origNumbers
(4, 2)
>>> n1.origModStrings
('+', None)
>>> n1.numbers
(6, 4, 2)
>>> n1.modifierStrings
(None, '+', None)
>>> n1.modifiers
(<modifier None None>, <modifier + <accidental sharp>>, <modifier None None>)
>>> n1.figures[0]
<music21.figuredBass.notation Figure 6 <modifier None None>>
>>> n1.figures[1]
<music21.figuredBass.notation Figure 4 <modifier + <accidental sharp>>>
>>> n1.figures[2]
<music21.figuredBass.notation Figure 2 <modifier None None>>
Here, a stand-alone # is being passed to Notation.
>>> n2 = notation.Notation("#")
>>> n2.numbers
(5, 3)
>>> n2.modifiers
(<modifier None None>, <modifier # <accidental sharp>>)
>>> n2.figures[0]
<music21.figuredBass.notation Figure 5 <modifier None None>>
>>> n2.figures[1]
<music21.figuredBass.notation Figure 3 <modifier # <accidental sharp>>>
Now, a stand-alone b is being passed to Notation as part of a larger notationColumn.
>>> n3 = notation.Notation("b6,b")
>>> n3.numbers
(6, 3)
>>> n3.modifiers
(<modifier b <accidental flat>>, <modifier b <accidental flat>>)
>>> n3.figures[0]
<music21.figuredBass.notation Figure 6 <modifier b <accidental flat>>>
>>> n3.figures[1]
<music21.figuredBass.notation Figure 3 <modifier b <accidental flat>>>
Notation attributes
- notationColumn¶
A string of figures delimited by commas, each associated with a number and an optional modifier.
- figureStrings¶
A list of figures derived from the original notationColumn.
- numbers¶
The numbers associated with the expanded notationColumn.
- modifiers¶
A list of Modifier objects associated with the expanded notationColumn.
- figures¶
A list of Figure objects associated with figures in the expanded notationColumn.
- origNumbers¶
The numbers associated with the original notationColumn.
- origModStrings¶
The modifiers associated with the original notationColumn, as strings.
- modifierStrings¶
The modifiers associated with the expanded notationColumn, as strings.
A Figure is created by providing a number and a modifierString. The modifierString is turned into a Modifier, and a ModifierException is raised if the modifierString is not valid.
>>> from music21.figuredBass import notation
>>> f1 = notation.Figure(4, '+')
>>> f1.number
4
>>> f1.modifierString
'+'
>>> f1.modifier
<modifier + <accidental sharp>>
>>> f1
<music21.figuredBass.notation Figure 4 <modifier + <accidental sharp>>>
Figure attributes
- modifierString¶
A modifier string associated with an expanded notationColumn.
- modifier¶
A Modifier associated with an expanded notationColumn.
- number¶
A number associated with an expanded notationColumn.
Turns a modifierString (a modifier in a notationColumn) to an Accidental. A ModifierException is raised if the modifierString is not valid.
Accepted inputs are those accepted by Accidental, as well as the following:
>>> from music21.figuredBass import notation
>>> m1a = notation.Modifier("#")
>>> m1a.modifierString
'#'
>>> m1a.accidental
<accidental sharp>
Providing a + in place of a sharp, we get the same result for the accidental.
>>> m2a = notation.Modifier("+")
>>> m2a.accidental
<accidental sharp>
If None or “” is provided for modifierString, then the accidental is None.
>>> m2a = notation.Modifier(None)
>>> m2a.accidental == None
True
>>> m2b = notation.Modifier("")
>>> m2b.accidental == None
True
Modifier attributes
- modifierString¶
A modifier string associated with an expanded notationColumn.
- accidental¶
A Accidental corresponding to modifierString.
Modifier methods
- modifyPitch(pitchToAlter, inPlace=False)¶
Given a Pitch, modify its accidental given the Modifier’s accidental.
>>> from music21 import pitch >>> from music21.figuredBass import notation >>> m1 = notation.Modifier('#') >>> m2 = notation.Modifier('-') >>> m3 = notation.Modifier('n') >>> p1a = pitch.Pitch('D5') >>> m1.modifyPitch(p1a) # Sharp D#5 >>> m2.modifyPitch(p1a) # Flat D-5 >>> p1b = pitch.Pitch('D#5') >>> m3.modifyPitch(p1b) D5
- modifyPitchName(pitchNameToAlter)¶
Given a pitch name, modify its accidental given the Modifier’s accidental.
>>> from music21.figuredBass import notation >>> m1 = notation.Modifier('#') >>> m2 = notation.Modifier('-') >>> m3 = notation.Modifier('n') >>> m1.modifyPitchName('D') # Sharp 'D#' >>> m2.modifyPitchName('F') # Flat 'F-' >>> m3.modifyPitchName('C#') # Natural 'C'