pctheory.pitch¶
- class PitchClass¶
Represents a pitch-class
- property mod¶
The pitch-class modulo
- property pc¶
The pitch-class, as an integer
- property pc_str¶
The pitch-class, as a string
- __init__(self, pc: int = 0, mod: int = 12)¶
Creates a PitchClass
- Parameters:
pc – The pitch class integer
mod – The mod number (12 for default chromatic pitch-classes,
24 for quarter-tone pitch-classes)
- __add__(self, other)¶
Adds a
PitchClassor integer to thisPitchClass.- Parameters:
other – The other item to add
- Returns:
A new
PitchClass
- __eq__(self, other)¶
Compares two pitch-classes for equality.
- Parameters:
other – The other
PitchClass- Returns:
TrueorFalse- Return type:
bool
- __ge__(self, other)¶
Determines if this
PitchClassis greater than or equal to anotherPitchClass.- Parameters:
other – The other
PitchClass- Returns:
TrueorFalse- Return type:
bool
- __gt__(self, other)¶
Determines if this
PitchClassis greater than anotherPitchClass.- Parameters:
other – The other
PitchClass- Returns:
TrueorFalse- Return type:
bool
- __hash__(self)¶
Gets the hash value of this
PitchClass.- Returns:
The hash value
- __le__(self, other)¶
Determines if this
PitchClassis less than or equal to anotherPitchClass.- Parameters:
other – The other
PitchClass- Returns:
TrueorFalse- Return type:
bool
- __lt__(self, other)¶
Determines if this
PitchClassis less than anotherPitchClass.- Parameters:
other – The other
PitchClass- Returns:
TrueorFalse- Return type:
bool
- __mul__(self, other)¶
Multiplies a
PitchClassor integer by thisPitchClass.- Parameters:
other – The item to multiply by
- Returns:
A new
PitchClass
- __ne__(self, other)¶
Compares two pitch-classes for equality.
- Parameters:
other – The other
PitchClass- Returns:
TrueorFalse- Return type:
bool
- __repr__(self)¶
Gets a representation of this
PitchClass.- Returns:
A representation
- __str__(self)¶
Gets a representation of this
PitchClass.- Returns:
A representation
- __sub__(self, other)¶
Subtracts a
PitchClassor integer from thisPitchClass.- Parameters:
other – The item to subtract
- Returns:
A new
PitchClass
- class Pitch(PitchClass)¶
Represents a pitch
- property p¶
The pitch number
- property pname¶
The pitch name
- property midi¶
The MIDI number
- __init__(self, p: int = 0, pc_mod: int = 12, pname: str = 0)¶
Creates a Pitch
- Parameters:
p – The pitch integer
pc_mod – The modulo for the underlying PitchClass
pname – The pitch name as a string (optional, for display purposes)
- __add__(self, other)¶
Adds a
Pitchor integer to thisPitch.- Parameters:
other – The other item to add
- Returns:
A new
Pitch
- __eq__(self, other)¶
Compares two pitches for equality.
- Parameters:
other – The other
Pitch- Returns:
TrueorFalse- Return type:
bool
- __ge__(self, other)¶
Determines if this
Pitchis greater than or equal to anotherPitch.- Parameters:
other – The other
Pitch- Returns:
TrueorFalse- Return type:
bool
- __gt__(self, other)¶
Determines if this
Pitchis greater than anotherPitch.- Parameters:
other – The other
Pitch- Returns:
TrueorFalse- Return type:
bool
- __hash__(self)¶
Gets the hash value of this
Pitch.- Returns:
The hash value
- __le__(self, other)¶
Determines if this
Pitchis less than or equal to anotherPitch.- Parameters:
other – The other
Pitch- Returns:
TrueorFalse- Return type:
bool
- __lt__(self, other)¶
Determines if this
Pitchis less than anotherPitch.- Parameters:
other – The other
Pitch- Returns:
TrueorFalse- Return type:
bool
- __mul__(self, other)¶
Multiplies a
Pitchor integer by thisPitch.- Parameters:
other – The item to multiply by
- Returns:
A new
Pitch
- __ne__(self, other)¶
Compares two pitches for equality.
- Parameters:
other – The other
Pitch- Returns:
TrueorFalse- Return type:
bool
- __repr__(self)¶
Gets a representation of this
Pitch.- Returns:
A representation
- __str__(self)¶
Gets a representation of this
Pitch.- Returns:
A representation
- __sub__(self, other)¶
Subtracts a
Pitchor integer from thisPitch.- Parameters:
other – The item to subtract
- Returns:
A new
Pitch