pyabc2.PitchClass

class pyabc2.PitchClass(value)

Pitch without octave. Value as integer chromatic distance from C in semitones (half steps).

Parameters:

value (int) – Chromatic distance from C in semitones (half steps). For example, C is 0, D is 2, B is 11.

Examples

>>> from pyabc2 import PitchClass
>>> PitchClass(0)
PitchClass(value=0, name='C')
>>> PitchClass(2)
PitchClass(value=2, name='D')
>>> PitchClass(11)
PitchClass(value=11, name='B')
>>> PitchClass.from_name('Bb')
PitchClass(value=10, name='Bb')
>>> PitchClass.from_name('E#')
PitchClass(value=5, name='E#')
>>> PitchClass(5)
PitchClass(value=5, name='F')
__init__(value)
Parameters:

value (int)

Methods

__init__(value)

from_name(name)

From pitch class name (e.g., C, F#).

from_pitch(p)

From pitch instance.

scale_degree_in(key, *[, num_fmt, acc_fmt])

String representation of scale degree allowing #/b.

scale_degree_int_in(key)

Integer scale degree in key.

solfege_in(key)

Solfège symbol in the context of a given key.

to_pitch(octave)

Convert to pitch in the specified octave.

unicode()

String repr using unicode accidental symbols.

value_in(key, *[, mod])

Chromatic value in key.

Attributes

acc

Accidentals in the note name.

dvalue_acc

Relative chromatic value of the accidentals.

equivalent_flat

equivalent_natural

equivalent_sharp

isflat

isnat

issharp

name

The note (pitch class) name (ASCII).

nat

Natural note name (without accidentals).

value_nat

Chromatic value ignoring accidentals.

value

Pitch class value (integer chromatic distance from C in semitones (half steps)).