Expand description
Music transformation layer for the SIM music constellation.
This crate applies transformations to musical material: classic operations
such as transpose, invert, retrograde, augment, and diminish; exact
identity-preserving staff operations for sustain, slur, expansion,
delayed-note voice separation, register unwrapping, slicing, composition,
and rhythm masks; configurable pitch and time remaps; pattern mutators; and
a capability-gated custom event filter pipeline. Every exact staff operation
returns a MusicTransform with stable identities and explicit edits.
General object transforms return new Music, optionally paired with
diagnostics in a TransformReport.
Structs§
- Additive
Staff Patch - Material introduced by a strictly additive staff transform.
- Callable
Filter Definition - A named, reusable filter definition stored in a registry.
- Callable
Filter Ref - A by-name reference to a registered callable filter.
- Callable
Filter Registry - Lookup table of
CallableFilterDefinitionvalues by name. - Callable
Pitch Map - Named pitch map that applies a fixed chromatic offset to each pitch.
- Custom
Filter - A declared, capability-gated event filter with input/output shapes.
- Custom
Filter Run - Output of evaluating a custom filter: produced events and traces.
- Custom
Filter Trace - A single recorded step of a custom filter’s evaluation.
- Custom
Pitch Axis - Named inversion axis carrying an explicit pitch.
- Exact
Voice Note - One sounding note with the three exact score identities needed to trace it.
- Exact
Voicing - Exact sounding notes at one score boundary.
- Filter
Capability Set - An ordered set of
FilterCapabilitygrants. - Filter
Context - Runtime grants and seed supplied when evaluating a custom filter.
- Filter
Rule - A
when -> oprule: an operation applied to matching events. - Filter
Shape - The set of lane kinds a filter port accepts.
- Function
MapRegistry - Lookup table of
FunctionMapvalues addressed by name. - IntMatrix
- Integer 2x3 affine matrix mapping
(degree, octave, 1)to a new pitch. - Invert
Transform - Inversion transform that mirrors pitch about a
PitchAxis. - MapInverse
Witness - Partial inverse row for a target value in a
PitchMap. - Music
Transform - Exact transform value paired with identity and change evidence.
- Pattern
Lock Set - Set of source note indices held fixed (locked) during mutation.
- Pattern
Mutator Config - Configuration describing a sequence of pattern mutations and their controls.
- Pattern
Mutator Player - Player that applies a
PatternMutatorConfigto incoming material. - Pitch
Map - Partial map from folded source classes to absolute target offsets.
- Pitch
MapComposition - Result of composing two
PitchMapvalues with per-class witnesses. - Pitch
MapResult - Result of applying a
PitchMapto one pitch. - Register
Range - Inclusive semitone bounds and tie policy for register unwrapping.
- Retrograde
Transform - Retrograde transform that reverses material under a
RetrogradeMode. - Rhythm
Mask - Periodic exact-onset rhythm mask.
- Serial
Note Evidence - One retained serial note-evidence binding keyed by transformed staff identities.
- Serial
Staff Transform - One transformed serial staff plus explicit provenance status.
- Serial
Transform Provenance - Explicit serial provenance retained or retired by one transform.
- Sustain
Span - Exact half-open sustain-pedal interval.
- Time
MapPoint - One
(input -> output)breakpoint in a piecewise-linear time map. - Transform
Chain - An ordered pipeline of
TransformStepvalues applied in sequence. - Transform
Diagnostic - A single diagnostic emitted by a transform, tagged with its origin.
- Transform
Report - Result of a transform: the produced music plus any diagnostics raised.
- Transpose
Transform - Transpose transform that shifts pitch by a
PitchDelta. - Tuning
Remap - Microtonal tuning offset expressed in cents.
- Voice
Leading - Certified minimum-cost transition between two exact voicings.
- Voice
Leading Path - Certified adjacent voice-leading path through an exact progression.
- Voice
Leading Path Certificate - Aggregate certificate for a sequence of independently certified legs.
- Voice
Leading Policy - Explicit costs and structural policy for exact voice leading.
- Voicing
Change - One directed transition in an exact voicing-change palette.
- Voicing
Change Palette - All directed transitions among a finite exact voicing palette.
- Warp
Marker - A warp anchor pairing a source time with its target time.
Enums§
- Assignment
Certificate - Optimality witness for one of the two assignment solvers.
- Custom
Filter Error - Error raised while building or evaluating a custom filter.
- Delayed
Note Order - Ordering used for simultaneous notes during delayed-note voice separation.
- Determinism
Policy - Determinism contract a custom filter promises to honor.
- Filter
Body - The evaluable body of a
CustomFilter. - Filter
Capability - A permission a custom filter must hold to perform a class of operations.
- Filter
Op - An operation a
FilterRuleperforms on a matching event. - Filter
Predicate - Condition selecting which events a
FilterRuleacts on. - Filter
Trace Action - The kind of action recorded in a
CustomFilterTrace. - Function
Map - Named diatonic function (mode) used to remap scale degrees onto pitches.
- MapComposition
Witness - Witness for one source class while composing two pitch maps.
- MapError
- Error returned by partial pitch map construction, application, or composition.
- MapWitness
- Witness explaining how a
PitchMaphandled one input pitch. - Music
Transform Change - One reversible or explicitly destructive change made by an exact transform.
- Mutation
Op - A single mutation operation applied to a pattern’s notes.
- Pattern
Mutator Error - Error raised while parsing or validating a pattern mutator.
- Pitch
Axis - Specification of the axis an
InvertTransformmirrors about. - Pitch
Delta - Amount and kind of pitch displacement for a transpose transform.
- Pitch
MapPolicy - Policy used when a
PitchMaphas no direct image for a source class. - Pitch
Remap - A pitch remapping strategy applied note by note across material.
- Register
Tie - Tie direction for equally near octave placements.
- Retrograde
Mode - Strategy for placing notes when reversing material in time.
- Serial
Provenance Status - Whether a serial provenance facet survived a transform or was retired explicitly.
- Stretch
Policy - Strategy for stretching or warping material along the time axis.
- Transform
Diagnostic Code - Classification of a problem a transform encountered while running.
- Transform
Error - Error returned by transforms that reject invalid scaling factors.
- Transform
Step - A single step in a
TransformChain, wrapping one transform kind. - Voice
Crossing Policy - Policy for assignments that reverse the order of two source voices.
- Voice
Leading Metric - Norm used to score semitone motion.
- Voice
Leading Motion - Identity-resolved interpretation of one generic assignment operation.
Statics§
- RECIPES
- Cookbook recipes for this lib, embedded at build time.
Functions§
- apply_
additive_ staff_ patch - Applies new voices and notes while retaining every source value verbatim.
- apply_
rhythm_ mask - Keeps notes whose exact onset lands on a
trueperiodic mask slot. - apply_
serial_ row_ operation - Applies a total row operation to the realized pitches and time order.
- augment
- Lengthens every onset and duration by
factor(time augmentation). - chord_
tones_ in - Snaps every note to the nearest pitch belonging to the given scale.
- compose_
pitch_ map_ report - Composes
afollowed byb, returning witnesses for lossy classes. - compose_
pitch_ maps - Composes
afollowed byb, discarding per-class witnesses. - diminish
- Shortens every onset and duration by
factor(time diminution). - ensure_
custom_ filter_ codec - Checks that a codec name is supported by the custom filter surface.
- expand_
staff - Expands every onset, note duration, and voice span by a positive exact factor.
- invert_
serial - Inverts every realized pitch class around
axis, preserving ids but retiring row-form labels. - lane_
kind_ from_ wire - Parses a lane kind from its wire label, if recognized.
- loop_n
- Repeats the material
ntimes back to back along the time axis. - map_
to_ function - Remaps each in-key note to the same scale degree under another function.
- mutate_
pattern - Applies a
PatternMutatorConfigto material and returns the mutated music. - parallel_
staff - Composes staffs in parallel, retaining exact onsets and maximum duration.
- pitch_
class_ name - Returns the canonical name of a pitch class.
- pitch_
invert - Inverts every note’s pitch about the given axis pitch.
- player_
mutator - Builds a
PatternMutatorPlayerfrom a mutator configuration. - progression_
multiply - Multiplies every exact onset, duration, and trailing span in a progression.
- progression_
overlay - Overlays exact progressions at the same origin.
- progression_
repeat - Repeats a progression back to back while keeping global identity unique.
- progression_
slice - Extracts an exact half-open progression window.
- quantize_
serial - Quantizes only when the result is already exact on the requested grid; otherwise fails closed.
- quarter
- Returns the
Timevalue for one quarter note (1/4). - remap_
serial_ voices - Renames voices through an explicit mapping while retaining note/event origins.
- remove_
additive_ staff_ patch - Removes exactly the material named by an additive patch.
- render_
serial_ notation_ score - Renders realized serial material to a notation-compatible score surface.
- restore_
register - Restores the original pitches recorded by
unwrap_register. - retrograde
- Reverses the material in time using the default
RetrogradeMode::Cutout. - retrograde_
invert - Applies
pitch_invertthenretrograde(retrograde inversion). - retrograde_
serial - Reverses realized chronology and retires chronology-dependent provenance explicitly.
- retrograde_
with_ mode - Reverses the material in time using the given
RetrogradeMode. - scale_
serial_ time - Scales exact onsets and durations while retaining pitch and serial evidence.
- separate_
delayed_ notes - Splits delayed overlapping notes into monophonic voices without moving them.
- sequence_
staff - Composes staffs in sequence, shifting later onsets by exact prior durations.
- shift_
octave - Shifts every note by the given number of whole octaves.
- silence
- Builds a
Restspanning the given duration. - simple_
melody - Builds a single-voice
Melodyfrom(MIDI key, duration)pairs. - slice
- Extracts the
[start, end)time window, clipping note spans to the bounds. - slice_
staff - Extracts an exact half-open staff slice and reports clipping/removal.
- slur_
staff - Connects each note in a voice to its next onset and marks it legato.
- sustain_
staff - Extends note releases that occur while one of
spansis active. - time_
invert - Mirrors note onsets about the total duration, then rebases to start at zero.
- transpose
- Transposes every note chromatically by the given number of semitones.
- transpose_
diatonic - Transposes every note by
stepsscale degrees within the given scale. - transpose_
serial - Transposes every realized pitch while retaining event and note identities.
- unwrap_
register - Chooses octave placements that minimize adjacent motion within
range. - verify_
voice_ leading - Re-checks exact endpoints, operation projection, and the discrete optimality certificate.
- verify_
voice_ leading_ path - Re-checks all leg certificates, adjacency, and the aggregate path total.
- voice_
leading - Finds certified minimum-cost voice leading without factorial permutation search.
- voice_
leading_ path - Finds every adjacent optimum and returns their checked path certificate.
- voicing_
change_ palette - Builds a duplicate-free, deterministic palette of every directed transition between distinct exact voicings.