NotatedPitch

class pitchtools.NotatedPitch(octave, diatonic_index, diatonic_name, chromatic_index, chromatic_name, diatonic_alteration, chromatic_alteration, accidental_name)[source]

Bases: object

A parsed notename to be queried in relation to its musical notation

It is returned by notated_pitch()

octave

the octave (4=central octave)

diatonic_index

The index of the pitch class without accidentals, 0=C, 1=D, 2=E, …

diatonic_name

The name corresponding to the diatonic_index: “C”, “D”, “E”, …

chromatic_index

The index of the chormatic pitch class: 0=C, 1=C#/Db, 2=D, …

chromatic_name

The name corresponding to the chromatic_index “C”, “Db”, …

diatonic_alteration

the alteration in relation to the diatonic pitch. For C# this would be 1.0, for Db this would be -1.0

chromatic_alteration

for C#+50 this would be 0.5

accidental_name

the name of the accidental used (‘natural’, ‘natural-up’,’quarter-sharp’, etc.)

Example

>>> notated_pitch("4C#+15")
NotatedPitch(octave=4, diatonic_index=0, diatonic_name='C', chromatic_index=1,
             chromatic_name='C#', diatonic_alteration=1.15, chromatic_alteration=0.15,
             accidental_name='sharp-up')
>>> notated_pitch("4Db+15")
NotatedPitch(octave=4, diatonic_index=1, diatonic_name='D', chromatic_index=1,
             chromatic_name='Db', diatonic_alteration=-0.85, chromatic_alteration=0.15,
             accidental_name='flat-up')

Attributes Summary

cents_deviation

The cents deviation from the notated chromatic pitch

cents_sign

The sign of the cents deviation ('', '+', '-')

cents_str

The cents deviation as a string

fullname

The full name of this notated pitch

is_black_key

Is this a black key?

is_white_key

Is this a white key?

midinote

The midinote corresponding to this notated pitch

vertical_position

Abstract value indicating the vertical notated position

Methods Summary

alteration_direction([min_alteration])

Returns the direction of the alteration

microtone_index([semitone_divisions])

The index of the nearest microtone

Attributes Documentation

cents_deviation

The cents deviation from the notated chromatic pitch

cents_sign

The sign of the cents deviation (‘’, ‘+’, ‘-‘)

cents_str

The cents deviation as a string

fullname

The full name of this notated pitch

is_black_key

Is this a black key?

is_white_key

Is this a white key?

midinote

The midinote corresponding to this notated pitch

vertical_position

Abstract value indicating the vertical notated position

Methods Documentation

alteration_direction(min_alteration=0.5)[source]

Returns the direction of the alteration

(the table assumes min_alteration==0.5)

Note

Alteration Direction

4C

0

4C#

1

4Eb

-1

4C+

1

4F-25

0

4Bb

-1

4A+25

0

microtone_index(semitone_divisions=2)[source]

The index of the nearest microtone

For example, if semitone_divisions is 2, then

note

microtone index

4C

0

5C

0

4C+

1

4C#

2

4Db

2

Return type:

int