Crate rstmt

Crate rstmt 

Source
Expand description

§rstmt

crates.io docs.rs GitHub License


Welcome to the rstmt crate! This crate is designed to be a complete computational framework for computational music theory.

§Goals

The primary goal for this framework is to establish concrete computational representations of various musical concepts. This is of particular importance for the scsys.io ecosystem, which is drive by eryon, a topological computational framework inspired by the neo-Riemannian theory (NRT).

§Features

The crate is heavily feature-gated to allow for a modular approach to the various components of the framework. The following features are available:

  • nrt: Enables the neo-Riemannian theory (NRT) module, which provides a computational representation of the NRT and its associated concepts.

§Features: Dependencies

  • alloc: enables the alloc crate, enabling the use of heap-allocated types such as Vec, Box, and String.
  • json: enables the JSON serialization and deserialization of the framework’s types using the serde_json crate.
  • rayon: enables parallelism using the rayon crate.
  • serde: enables serialization and deserialization of implemented types using the serde crate.

§_Features: Environment

  • std: Enables the standard library, which provides additional functionality and convenience methods for the framework.
  • nightly: Enables the nightly features, which provide additional functionality and performance improvements. This feature is not recommended for production use, as it may introduce breaking changes or instability.

Modules§

chords
this module defines the chord-related implementations, interfaces, and more in an effort to generalize their behavior across various representations.
compose
composition related implementations, primitives, and utilities for creating music with the framework.
consts
various constants defined and used throughout the library.
error
this module defines the Error type and provides a type alias for a Result with an Error.
freq
intervals
this module implements intervallic relationships in music theory
notes
this module contains various implementations and traits for defining and manipulating musical notes. The NoteBase struct provides a generic representation of a musical note that is parameterized by a pitch class and an octave.
nrt
This crate works to establish a solid foundation fo exploring the neo-riemannian theory, providing implementations of the Triad, its transformations LPR, and the generalized tonnetz (HyperTonnetz).
octave
pitch
this module implements various pitch-related items used throughout the library. Some of the key abstractions defined here are the Pitch and PitchClass implementations designed to generically represent these musical concepts. The PitchClass isn’t necessarily intended to be used directly, rather through type aliases such as C, DSharp, EFlat, etc. Additionally, the module provides various traits, types, and other implementations aimed at facilitating the manipulation and representation of pitches in a musical context.
traits
A collection of useful traits focused on musical abstractions, composition, and operations.
types
this module imimplements various types and other primitives used throughout the library

Structs§

AFlatNote
ANote
ASharpNote
Aspn
An american scientific pitch notation (Aspn) representation of a musical note; this standard is used to represent notes in a way that is consistent with the American scientific pitch notation system, which uses a combination of a pitch class (represented as an integer) and an octave (represented as an Octave) to uniquely identify a musical note. The pitch class is the note’s position in the chromatic scale, while the octave indicates the note’s position in the musical range.
Augmented
BFlatNote
BNote
CNote
CSharpNote
ConstInterval
DFlatNote
DNote
DSharpNote
Diminished
EFlatNote
ENote
FNote
FSharpNote
Fifth
FifthsIter
An iterator over the variants of Fifths
Flat
FlatsIter
An iterator over the variants of Flats
Fourth
FourthsIter
An iterator over the variants of Fourths
Frequency
The Frequency type is a generic wrapper around type T that implements the [RawFrequency] trait. This implementation is designed to provide a consistent interface for dealing with frequencies within the crate, enabling conversion, arithmetic operations, and other utilities that are common to frequency values.
GFlatNote
GNote
GSharpNote
HalfTone
HarmonicFunctionIter
An iterator over the variants of HarmonicFunction
IntervalBase
Major
Minor
Natural
NaturalsIter
An iterator over the variants of Naturals
NoteBase
The NoteBase is a generic representation of a musical note
NoteFlagIter
An iterator over the variants of NoteFlag
Octave
A type defining an octave
Perfect
Pitch
The Pitch implementation is a generic wrapper used to represent a musical pitch. A pitch is defined to be a perceptual property of sounds that enables one to define the highness or lowness of a sound. In music, pitch is often associated with the frequency of a sound wave, with higher frequencies corresponding to higher pitches.
PitchClass
The PitchClass implementations works to generically define the structure for a pitch class. This is accomplished through the use of two type parameters: N, which defines the note (e.g., C, D, E, etc.), and K, which defines the kind of pitch (e.g., sharp, flat, natural, etc.).
Scale
The Scale implementation uses the defined root or anchor frequency as the basis for classfifications and other related computations.
Seventh
SeventhsIter
An iterator over the variants of Sevenths
Sharp
SharpsIter
An iterator over the variants of Sharps
Sixth
SixthsIter
An iterator over the variants of Sixths
StepSizeIter
An iterator over the variants of StepSize
Third
ThirdsIter
An iterator over the variants of Thirds
Tone

Enums§

Error
The Error enum represents various errors that can occur in the application.
Fifths
Flats
A representation of the flat pitch class
Fourths
HarmonicFunction
Harmonic functions in tonal music
Intervals
Naturals
A representation of the natural pitch class
NoteFlag
Notes
Notes is an enumeration of all allowed symbolic representations of pitch classes considered in music theory. For us, it provides a dynamic way of managing the different pitch classes whiole providing a direct mapping to a static index
Sevenths
Sharps
A representation of the sharp pitch class
SingleOrDouble
Sixths
StepSize
StepSize provides an enumeration for musical step sizes, namely semitones and tones. The implementation primarily works to provide a generic unit of measurement for musical intervals.
Thirds
Represents the various kinds of thirds in music theory.

Constants§

A4_FREQUENCY
Defines the frequency of the A4 note in Hertz.
C4_FREQUENCY
Defines the frequency of the C4 note in Hertz.
C_MAJOR_SCALE
The C Major scale represented as an array of pitch class indices.
DOUBLE_FLAT_SYMBOL
DOUBLE_SHARP_SYMBOL
ENHARMONIC_EQUIVALENTS
FLAT_PITCH_CLASSES
FLAT_SYMBOL
NATURAL_PITCH_CLASSES
NATURAL_SYMBOL
OCTAVE_SIZE
SHARP_PITCH_CLASSES
SHARP_SYMBOL

Traits§

Accidental
Accidental is a sealed marker trait used to designate various kinds of musical notes, i.e., sharp, flat, natural, etc.
AsAspn
The AsAspn trait is used to convert a reference into a Aspn
AsOctave
A trait for converting a reference into an Octave.
AsPitch
A trait for converting a reference into a Pitch.
Chroma
Chroma defines a trait for establishing a chromatic relationship between pitches.
Classify
Classify defines an interface for objects capable of being classified as other types.
ClassifyBy
ClassifyBy is a trait defining the ability for an object to be classified by or with another object.
Dirac
Dirac is used to define a specific transformation operation
IntervalKind
The IntervalKind trait is a sealed marker trait used to define the allowable representations, or kinds, of musical intervals.
IntoAspn
A trait for converting a type into a Aspn
IntoOctave
A trait for converting a type into an Octave.
IntoPitch
IntoPitch defines a consuming conversion from some type into a Pitch.
IntoPitchClass
MusicScalar
NumPitch
NumPitch extends the RawPitch trait with additional capabilities for numerical types. The trait is automatically implemented for all
Numerical
OrderedNum
The OrderedNum trait defines the behavior of ordered numerical types, providing methods for establishing the sign of a number and other fundamental numerical operations.
PitchClassRepr
PitchClassRepr extends RawPitchClass, providing various initialization routines, defaults, and other methods useful for pitch class representations.
PitchMod
The PitchMod trait is a particular implementation of the PyMod trait, specifically binding the caller to a mod 12 space.
Pitched
The Pitched trait provides a method for viewing the pitch of the implementor.
PyMod
PyMod is a modulo operator inspired by Python’s % operator, which handles negative values differently than rust’s built-in % operator. Specifically, the sign of the result will always match the sign of the divisor.
Quality
RawChord
The RawChord trait works to define a basic interface shared by all compatible reprsentations of a chord. Since a chord is essentially a sequence of pitches, the trait captures this behavior through association with an element type.
RawChordMut
The RawChordMut trait extends the RawChord trait to provide mutable access to the underlying elements of the chord representation.
RawFrequency
RawFrequency is a marker trait denoting objects capable of representing a frequency
RawOctave
RawOctave is a marker trait denoting objects allowed to define octaves; it is implemented for all (un)signed integer types.
RawPitch
RawPitch defines an interface for all raw pitch types.
RawPitchClass
The RawPitchClass is a sealed trait used to define raw pitch class types.
RawQuality
Quality is a sealed marker trait used to define compatible intervallic qualities.
Semitone
Similar to the One trait, the Semitone is an identity and unit for musical contexts.
StepSizeOps
StepSizeOps provides a generic trait for types that can be operated on with StepSize values.
Transform
The Transform trait establishes a binary operation that for objects capable of being transformed by another object of type Rhs, producing some output.
TruncDiv
The TruncDiv trait defines an operator for truncated division, which discards the fractional part of the quotient, returning only the integer component. This differs from div_floor in that it truncates towards zero rather than towards negative infinity.
Unison
A musical unison is the identity interval in music theory, representing no pitch difference.
WholeTone

Type Aliases§

A
AFlat
ASharp
B
BFlat
C
CSharp
D
DFlat
DSharp
E
EFlat
F
FSharp
G
GFlat
GSharp
MajorInterval
Result
a type alias for a Result with a Error type