Skip to main content

Crate sim_lib_pitch_set

Crate sim_lib_pitch_set 

Source
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 PitchClassMask with an optional designated root.
ForteFact
A derived Forte-compatible fact for a pitch-set class.
GapForm
Directed interval steps between adjacent pitch classes in a cyclic ordering.
IntervalForm
Pairwise directed pitch-class intervals.
IntervalVector
An interval-class vector: counts of each of the six interval classes (1..=6) occurring among a set’s pitch classes.
PitchClassMask
A bitmask over the twelve pitch classes, with bit n set when pitch class n is present.
PitchRangeMask
A bitmask over the 128 MIDI keys, with bit n set when MIDI key n is present.
PitchSetNeighborhood
Graph builder for pitch-set neighborhoods.
PitchSetSpace
Pitch-class universe used by a neighborhood graph.
SetClass
Conventional pitch-set class identity.
SetRelationAnalysis
Reproducible set-theory evidence relating two pitch-class masks.
ThirdStackSignature
A chord described as a root pitch class plus an ordered stack of third ThirdSteps.

Enums§

PitchSetError
Error returned when a pitch-set value cannot be constructed, encoded, or decoded.
PitchSetGraphError
Error raised while building a pitch-set graph.
PitchSetMovePolicy
Allowed move family between pitch-class sets.
SetEquivalence
Conventional pitch-set equivalence policy.
SetInclusion
Exact inclusion relation between two pitch-class masks.
ThirdStep
A single step in a stack of thirds: a minor third (3 semitones) or major third (4 semitones).
ZeroGapPolicy
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.