pub struct PitchClassSet {
pub classes: HashSet<PitchClass>,
}Expand description
A collection of unique pitch classes, used in atonal music analysis.
Provides set theory operations like normal form, prime form, and interval class vectors.
Fields§
§classes: HashSet<PitchClass>Implementations§
Source§impl PitchClassSet
impl PitchClassSet
pub fn new(classes: Vec<PitchClass>) -> Self
pub fn from_u8_values(values: Vec<u8>) -> Self
pub fn from_pitches(pitches: &[Pitch]) -> Self
Sourcepub fn normal_form(&self) -> PitchClassSet
pub fn normal_form(&self) -> PitchClassSet
Computes the normal form of the pitch class set.
Normal form is the most compact ordering of the set, starting from 0, with the smallest possible span. This provides a canonical representation for comparing sets regardless of transposition.
Sourcepub fn prime_form(&self) -> PitchClassSet
pub fn prime_form(&self) -> PitchClassSet
Computes the prime form of the pitch class set.
Prime form is the most compact form among the set and its inversion, providing a canonical representation that’s invariant under both transposition and inversion. This is used to identify set classes.
Sourcepub fn set_class(&self) -> Vec<PitchClassSet>
pub fn set_class(&self) -> Vec<PitchClassSet>
Generates all members of the set class (transpositions and inversions).
Returns all 24 possible transformations (12 transpositions × 2 for inversion) of the set, which together form the complete set class.
Sourcepub fn interval_class_vector(&self) -> [u8; 6]
pub fn interval_class_vector(&self) -> [u8; 6]
Calculates the interval class vector of the set.
Returns a 6-element array counting occurrences of each interval class (1-6) between all pairs of pitch classes in the set. This provides a unique “fingerprint” for many set classes, useful for analysis and comparison.
§Returns
Array where index 0 = minor seconds/major sevenths (ic1), index 1 = major seconds/minor sevenths (ic2), etc.
Trait Implementations§
Source§impl Clone for PitchClassSet
impl Clone for PitchClassSet
Source§fn clone(&self) -> PitchClassSet
fn clone(&self) -> PitchClassSet
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PitchClassSet
impl Debug for PitchClassSet
impl Eq for PitchClassSet
Source§impl Hash for PitchClassSet
impl Hash for PitchClassSet
Source§impl Invert for PitchClassSet
impl Invert for PitchClassSet
Source§fn invert(&self, axis: &PitchClass) -> Self
fn invert(&self, axis: &PitchClass) -> Self
Source§impl Ord for PitchClassSet
impl Ord for PitchClassSet
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for PitchClassSet
impl PartialEq for PitchClassSet
Source§fn eq(&self, other: &PitchClassSet) -> bool
fn eq(&self, other: &PitchClassSet) -> bool
self and other values to be equal, and is used by ==.