music21.figuredBass.notation

Notation

class music21.figuredBass.notation.Notation(notationColumn=None)

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.

  • None, ‘’ or ‘5’ -> ‘5,3’

  • ‘6’ -> ‘6,3’

  • ‘7’ -> ‘7,5,3’

  • ‘6,5’ -> ‘6,5,3’

  • ‘4,3’ -> ‘6,4,3’

  • ‘4,2’ or ‘2’ -> ‘6,4,2’

  • ‘9’ -> ‘9,7,5,3’

  • ‘11’ -> ‘11,9,7,5,3’

  • ‘13’ -> ‘13,11,9,7,5,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
<music21.figuredBass.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
(<music21.figuredBass.notation.Modifier None None>,
 <music21.figuredBass.notation.Modifier + sharp>,
 <music21.figuredBass.notation.Modifier None None>)
>>> n1.figures[0]
<music21.figuredBass.notation.Figure 6 <Modifier None None>>
>>> n1.figures[1]
<music21.figuredBass.notation.Figure 4 <Modifier + 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
(<music21.figuredBass.notation.Modifier None None>,
 <music21.figuredBass.notation.Modifier # sharp>)
>>> n2.figures[0]
<music21.figuredBass.notation.Figure 5 <Modifier None None>>
>>> n2.figures[1]
<music21.figuredBass.notation.Figure 3 <Modifier # 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
(<music21.figuredBass.notation.Modifier b flat>,
 <music21.figuredBass.notation.Modifier b flat>)
>>> n3.figures[0]
<music21.figuredBass.notation.Figure 6 <Modifier b flat>>
>>> n3.figures[1]
<music21.figuredBass.notation.Figure 3 <Modifier b flat>>

Notation bases

Notation read-only properties

Read-only properties inherited from ProtoM21Object:

Notation methods

Methods inherited from ProtoM21Object:

Notation instance variables

Notation.figureStrings

A list of figures derived from the original notationColumn.

Notation.figures

A list of Figure objects associated with figures in the expanded notationColumn.

Notation.modifierStrings

The modifiers associated with the expanded notationColumn, as strings.

Notation.modifiers

A list of Modifier objects associated with the expanded notationColumn.

Notation.notationColumn

A string of figures delimited by commas, each associated with a number and an optional modifier.

Notation.numbers

The numbers associated with the expanded notationColumn.

Notation.origModStrings

The modifiers associated with the original notationColumn, as strings.

Notation.origNumbers

The numbers associated with the original notationColumn.

Figure

class music21.figuredBass.notation.Figure(number=1, modifierString=None)

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
<music21.figuredBass.notation.Figure 4 <Modifier + sharp>>
>>> f1.number
4
>>> f1.modifierString
'+'
>>> f1.modifier
<music21.figuredBass.notation.Modifier + sharp>

Figure bases

Figure read-only properties

Read-only properties inherited from ProtoM21Object:

Figure methods

Methods inherited from ProtoM21Object:

Figure instance variables

Figure.modifier

A Modifier associated with an expanded notationColumn.

Figure.modifierString

A modifier string associated with an expanded notationColumn.

Figure.number

A number associated with an expanded notationColumn.

Modifier

class music21.figuredBass.notation.Modifier(modifierString=None)

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:

  • ‘+’ or ‘' -> ‘#’

  • ‘b’ or ‘/’ -> ‘-’

>>> from music21.figuredBass import notation
>>> m1a = notation.Modifier('#')
>>> m1a
<music21.figuredBass.notation.Modifier # sharp>
>>> m1a.modifierString
'#'
>>> m1a.accidental
<music21.pitch.Accidental sharp>

Providing a + in place of a sharp, we get the same result for the accidental.

>>> m2a = notation.Modifier('+')
>>> m2a
<music21.figuredBass.notation.Modifier + sharp>
>>> m2a.accidental
<music21.pitch.Accidental sharp>

If None or ‘’ is provided for modifierString, then the accidental is None.

>>> m3a = notation.Modifier(None)
>>> m3a
<music21.figuredBass.notation.Modifier None None>
>>> m3a.accidental is None
True
>>> m3b = notation.Modifier('')
>>> m3b
<music21.figuredBass.notation.Modifier  None>
>>> m3b.accidental is None
True

Modifier bases

Modifier read-only properties

Read-only properties inherited from ProtoM21Object:

Modifier methods

Modifier.modifyPitch(pitchToAlter, *, inPlace=False)

Given a Pitch, modify its accidental given the Modifier’s accidental.

>>> from music21.figuredBass import notation
>>> m1 = notation.Modifier('#')
>>> m2 = notation.Modifier('-')
>>> m3 = notation.Modifier('n')
>>> p1a = pitch.Pitch('D5')
>>> m1.modifyPitch(p1a)  # Sharp
<music21.pitch.Pitch D#5>
>>> m2.modifyPitch(p1a)  # Flat
<music21.pitch.Pitch D-5>
>>> p1b = pitch.Pitch('D#5')
>>> m3.modifyPitch(p1b)
<music21.pitch.Pitch D5>
Modifier.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'

Methods inherited from ProtoM21Object:

Modifier instance variables

Modifier.accidental

A Accidental corresponding to modifierString.

Modifier.modifierString

A modifier string associated with an expanded notationColumn.

Functions

music21.figuredBass.notation.convertToPitch(pitchString)

Converts a pitchString to a Pitch, only if necessary.

>>> from music21.figuredBass import notation
>>> pitchStr = 'C5'
>>> notation.convertToPitch(pitchStr)
<music21.pitch.Pitch C5>
>>> notation.convertToPitch(pitch.Pitch('E4'))  # does nothing
<music21.pitch.Pitch E4>