pub struct PitchMap {
pub domain: OctaveSpace,
pub image: Vec<Option<i32>>,
pub policy: PitchMapPolicy,
}Expand description
Partial map from folded source classes to absolute target offsets.
Fields§
§domain: OctaveSpaceSource octave-like domain.
image: Vec<Option<i32>>Per-source-class target offsets. None records a hole.
policy: PitchMapPolicyPolicy for holes during pitch application.
Implementations§
Source§impl PitchMap
impl PitchMap
Sourcepub fn new(
domain: OctaveSpace,
image: Vec<Option<i32>>,
policy: PitchMapPolicy,
) -> Result<Self, MapError>
pub fn new( domain: OctaveSpace, image: Vec<Option<i32>>, policy: PitchMapPolicy, ) -> Result<Self, MapError>
Builds a pitch map and verifies that the image covers the whole domain.
Sourcepub fn identity(domain: OctaveSpace, policy: PitchMapPolicy) -> Self
pub fn identity(domain: OctaveSpace, policy: PitchMapPolicy) -> Self
Builds an identity map over domain.
Sourcepub fn chromatic_delta(semitones: i32) -> Self
pub fn chromatic_delta(semitones: i32) -> Self
Builds a chromatic transposition map in twelve-tone semitone space.
Sourcepub fn rotation(domain: OctaveSpace, steps: i32, policy: PitchMapPolicy) -> Self
pub fn rotation(domain: OctaveSpace, steps: i32, policy: PitchMapPolicy) -> Self
Builds a pitch-class rotation map over any octave space.
Sourcepub fn inversion(axis: PitchClass) -> Self
pub fn inversion(axis: PitchClass) -> Self
Builds a twelve-tone inversion map around axis.
Sourcepub fn pitch_class_substitution(
from: PitchClass,
to: PitchClass,
policy: PitchMapPolicy,
) -> Self
pub fn pitch_class_substitution( from: PitchClass, to: PitchClass, policy: PitchMapPolicy, ) -> Self
Builds a twelve-tone pitch-class substitution map.
Sourcepub fn from_scale(scale: Scale, policy: PitchMapPolicy) -> Self
pub fn from_scale(scale: Scale, policy: PitchMapPolicy) -> Self
Builds a partial scale-lock map whose holes are handled by policy.
Sourcepub fn is_partial(&self) -> bool
pub fn is_partial(&self) -> bool
Returns true when at least one source class has no direct image.
Sourcepub fn map_pitch(&self, pitch: Pitch) -> Result<PitchMapResult, MapError>
pub fn map_pitch(&self, pitch: Pitch) -> Result<PitchMapResult, MapError>
Applies the map to a pitch, returning the pitch and an explicit witness.
Sourcepub fn inverse_witnesses(&self) -> Vec<MapInverseWitness>
pub fn inverse_witnesses(&self) -> Vec<MapInverseWitness>
Returns grouped direct inverse witnesses for every target value.
Sourcepub fn has_partial_inverse(&self) -> bool
pub fn has_partial_inverse(&self) -> bool
Returns true when the direct inverse is incomplete or many-to-one.