Expand description
Pitch-class set representations and operations for the SIM music libraries.
This crate models unordered collections of pitches as compact bitmasks. A
PitchClassMask packs the twelve pitch classes into a u16, supporting
rotation (transposition), inversion, numeric normalization, conventional
normal-order and prime-form classification, complements, set inclusion,
symmetry, Z-relation, interval/gap forms, graph neighborhoods, and the
IntervalVector census used by set theory. analyze_set_relations
reports exact Tn/TnI operators, canonical equivalence, inclusion,
complements, and Z-relations without conflating conventional prime form with
numeric normalization. PitchRangeMask does the same across the full 128-key
MIDI range. BitChord pairs a mask with an optional root, and
ThirdStackSignature encodes chords as stacks of minor and major thirds.
Structs§
- BitChord
- A chord represented as a
PitchClassMaskwith an optional designated root. - Forte
Fact - A derived Forte-compatible fact for a pitch-set class.
- GapForm
- Directed interval steps between adjacent pitch classes in a cyclic ordering.
- Interval
Form - Pairwise directed pitch-class intervals.
- Interval
Vector - An interval-class vector: counts of each of the six interval classes (1..=6) occurring among a set’s pitch classes.
- Pitch
Class Mask - A bitmask over the twelve pitch classes, with bit
nset when pitch classnis present. - Pitch
Range Mask - A bitmask over the 128 MIDI keys, with bit
nset when MIDI keynis present. - Pitch
SetNeighborhood - Graph builder for pitch-set neighborhoods.
- Pitch
SetSpace - Pitch-class universe used by a neighborhood graph.
- SetClass
- Conventional pitch-set class identity.
- SetRelation
Analysis - Reproducible set-theory evidence relating two pitch-class masks.
- Third
Stack Signature - A chord described as a root pitch class plus an ordered stack of third
ThirdSteps.
Enums§
- Pitch
SetError - Error returned when a pitch-set value cannot be constructed, encoded, or decoded.
- Pitch
SetGraph Error - Error raised while building a pitch-set graph.
- Pitch
SetMove Policy - Allowed move family between pitch-class sets.
- SetEquivalence
- Conventional pitch-set equivalence policy.
- SetInclusion
- Exact inclusion relation between two pitch-class masks.
- Third
Step - A single step in a stack of thirds: a minor third (3 semitones) or major third (4 semitones).
- Zero
GapPolicy - How zero-sized gaps are represented.
Statics§
- RECIPES
- Cookbook recipes for this lib, embedded at build time.
Functions§
- analyze_
set_ relations - Analyzes exact and canonical relations between two pitch-class masks.
- classify_
set - Classifies a pitch-class mask using conventional normal-order and prime-form identity.
- forte_
fact_ for - Returns a small Forte-compatible example fact when the class is one this crate names explicitly.
- gap_
form_ from_ pitch_ classes - Return adjacent cyclic gaps for caller-owned pitch-class material.
- interval_
form_ from_ pitch_ classes - Return directed pairwise intervals for caller-owned pitch-class material.