Skip to main content

Crate music21_rs

Crate music21_rs 

Source
Expand description

Rust helpers inspired by selected parts of Python’s music21.

The crate currently focuses on pitch construction, chord naming and lightweight theory utilities such as polyrhythm and tuning-system helpers.

Re-exports§

pub use abc::abc_chord;
pub use abc::abc_duration;
pub use abc::abc_note;
pub use abc::abc_rest;
pub use abc::pitch_name_from_abc_note;
pub use abc::pitch_names_from_abc_chord;
pub use analysis::KeyEstimate;
pub use analysis::KeyProfile;
pub use analysis::estimate_key_from_chords;
pub use analysis::estimate_key_from_chords_with;
pub use analysis::estimate_key_from_pitches;
pub use analysis::estimate_key_from_pitches_with;
pub use analysis::tonal_certainty;
pub use analysis::tonal_certainty_from_scores;
pub use chord::Chord;
pub use chord::ChordResolutionSuggestion;
pub use chord::ChordTableAddress;
pub use chord::GuitarFingering;
pub use chord::GuitarStringFingering;
pub use chord::GuitarTuning;
pub use chord::GuitarTuningString;
pub use chord::IntoNotes;
pub use chord::KnownChordType;
pub use chord::TriadQuality;
pub use chord::format_vector_string;
pub use chordsymbol::ChordAlteration;
pub use chordsymbol::ChordQuality;
pub use chordsymbol::ChordSymbol;
pub use chordsymbol::Music21ChordType;
pub use chordsymbol::chord_symbol_figure_from_chord;
pub use chordsymbol::chord_symbol_from_chord;
pub use chordsymbol::known_chord_symbol_types;
pub use duration::Duration;
pub use duration::DurationType;
pub use duration::Tuplet;
pub use duration::quarter_length_to_closest_type;
pub use error::Error;
pub use error::Result;
pub use harte::Harte;
pub use harte::HarteInterval;
pub use harte::SHORTHAND_DEGREES;
pub use harte::convert_interval;
pub use interval::ChromaticInterval;
pub use interval::DiatonicInterval;
pub use interval::GenericInterval;
pub use interval::Interval;
pub use interval::IntervalDirection;
pub use interval::Specifier;
pub use interval::absolute_higher_pitch;
pub use interval::absolute_lower_pitch;
pub use interval::convert_diatonic_number_to_step;
pub use interval::convert_generic;
pub use interval::convert_semitone_to_specifier_generic;
pub use interval::convert_semitone_to_specifier_generic_microtone;
pub use interval::intervals_to_diatonic;
pub use interval::notes_to_chromatic;
pub use interval::notes_to_generic;
pub use interval::parse_specifier;
pub use interval::staff_distance_to_generic_number;
pub use interval::written_higher_pitch;
pub use interval::written_lower_pitch;
pub use key::Key;
pub use key::KeySignature;
pub use key::convert_key_string_to_music21_key_string;
pub use meter::BeamedNote;
pub use meter::BeatDivision;
pub use meter::MeterTerminal;
pub use meter::OffsetAlign;
pub use meter::TimeSignature;
pub use midi::DEFAULT_TICKS_PER_QUARTER;
pub use midi::MidiNote;
pub use midi::midi_notes_from_stream;
pub use midi::read_midi_bytes;
pub use midi::read_midi_bytes_with_tempo;
pub use midi::stream_from_midi_notes;
pub use midi::write_midi_bytes;
pub use notation::Beam;
pub use notation::BeamDirection;
pub use notation::BeamType;
pub use notation::Beams;
pub use notation::Lyric;
pub use notation::Notehead;
pub use notation::Placement;
pub use notation::StemDirection;
pub use notation::Syllabic;
pub use notation::Tie;
pub use notation::TieStyle;
pub use notation::TieType;
pub use note::IntoNote;
pub use note::Note;
pub use pitch::Accidental;
pub use pitch::AccidentalAttribute;
pub use pitch::AccidentalDisplayOptions;
pub use pitch::AccidentalSpecifier;
pub use pitch::CHROMATIC_PITCH_CLASS_NAMES;
pub use pitch::Microtone;
pub use pitch::MicrotoneSpecifier;
pub use pitch::Pitch;
pub use pitch::PitchClass;
pub use pitch::PitchClassSpecifier;
pub use pitch::PitchName;
pub use pitch::PitchOptions;
pub use pitch::convert_pitch_class_to_str;
pub use pitch::dissonance_score;
pub use pitch::pitch_class_name;
pub use pitch::simplify_multiple_enharmonics;
pub use polyrhythm::Polyrhythm;
pub use polyrhythm::PolyrhythmAnalysis;
pub use polyrhythm::PolyrhythmEvent;
pub use polyrhythm::PolyrhythmRatioTone;
pub use rest::Rest;
pub use roman::roman_numeral_from_chord;
pub use roman::ImpliedQuality;
pub use roman::Minor67Default;
pub use roman::NumeralAlone;
pub use roman::RomanNumeral;
pub use roman::analyze_chord;
pub use roman::analyze_chord_with_root;
pub use roman::identify_as_tonic_or_dominant;
pub use roman::roman_inversion_name;
pub use scale::BluesForm;
pub use scale::DegreeComparison;
pub use scale::DiatonicScale;
pub use scale::Scale;
pub use scale::ScaleType;
pub use scale::SolfegVariant;
pub use scale::StepScale;
pub use scale::WeightedHexatonicBlues;
pub use serial::HISTORICAL_ROWS;
pub use serial::HistoricalRow;
pub use serial::IndexedTransformation;
pub use serial::LinkClassification;
pub use serial::ToneRow;
pub use serial::Transformation;
pub use serial::TransformationConvention;
pub use serial::TwelveToneMatrix;
pub use serial::historical_row_by_name;
pub use serial::row_to_matrix;
pub use sieve::Sieve;
pub use stream::Stream;
pub use stream::StreamElement;
pub use stream::StreamEvent;
pub use stream::StreamKind;
pub use tempo::DEFAULT_TEMPO_VALUES;
pub use tempo::MetronomeMark;
pub use tempo::convert_tempo_by_referent;
pub use tuningsystem::ALL_TUNING_SYSTEMS;
pub use tuningsystem::COMMON_EQUAL_TEMPERAMENTS;
pub use tuningsystem::COMMON_TWELVE_TONE_TUNING_SYSTEMS;
pub use tuningsystem::EqualDivision;
pub use tuningsystem::Fraction;
pub use tuningsystem::HISTORICAL_TEMPERAMENTS;
pub use tuningsystem::Monzo;
pub use tuningsystem::Mos;
pub use tuningsystem::MosScale;
pub use tuningsystem::OCTAVE_CENTS;
pub use tuningsystem::TRITAVE_CENTS;
pub use tuningsystem::Temperament;
pub use tuningsystem::TuningSystem;
pub use tuningsystem::Val;
pub use tuningsystem::moment_of_symmetry_sizes;
pub use tuningsystem::scala::ScalaArchive;
pub use tuningsystem::scala::ScalaDegree;
pub use tuningsystem::scala::ScalaScale;
pub use voiceleading::MotionType;
pub use voiceleading::VoiceLeadingQuartet;
pub use volume::Volume;

Modules§

abc
ABC notation export helpers. ABC notation format helpers.
analysis
Key-finding and compact analysis helpers.
chord
Chord construction, common-name analysis and chord input conversion traits.
chordsymbol
Lead-sheet chord-symbol parsing.
duration
Rhythmic duration primitives.
error
Error and result types used by the crate.
figuredbass
Figured bass: the numbers written under a bass note. Figured bass: the numbers written under a bass note, and what they mean.
harte
Harte chord notation: C:maj7/3, Bb:(b3,5,b7,9), N. Harte chord notation, as read by harte-library: C:maj7/3, Bb:(b3,5,b7,9), F:sus4(*3,9), N.
interval
Public interval parsing, naming and transposition helpers.
key
Public key and key-signature helpers.
meter
Time signatures: bar length, beat count, beat length and beat division. Time signatures, ported from music21’s meter package.
midi
Minimal MIDI import/export helpers.
notation
Ties, noteheads, stem direction, colour, lyrics and beams. Notation attached to a note or a chord: ties, noteheads, stem direction, colour and lyrics.
note
Note construction and pitch access helpers.
pitch
Pitch construction, spelling and pitch-space helpers.
polyrhythm
Polyrhythm timing and pitch-set helpers.
rest
Silent duration-bearing musical event.
roman
Roman numeral parsing and compact harmonic analysis.
scale
Public scale helpers.
serial
Tone rows, twelve-tone matrices and serial transformations. Tone rows and twelve-tone serial transformations, a port of music21’s serial module.
sieve
Xenakis sieves, ported from music21’s sieve module.
stream
Small ordered timeline container. Music on a timeline: music21’s stream.Stream and the subclasses it nests inside one another.
tempo
Metronome marks and tempo-word conventions. Metronome marks, a port of the stream-free part of music21’s tempo.
tuningsystem
Tuning-system ratios, labels and frequency helpers.
voiceleading
Two-voice voice-leading classification and parallel-interval checks. Two-voice voice-leading checks, a port of music21’s VoiceLeadingQuartet.
volume
How loud a note is: music21’s volume.Volume.

Type Aliases§

FloatType
Floating-point type used for pitch space, quarter lengths, and frequencies.
FractionType
Fraction type used by ratio and interval helpers.
IntegerType
Signed integer type used by music21-rs APIs.
Octave
Optional octave number, matching music21’s absent-octave representation.
UnsignedIntegerType
Unsigned integer type used by count-like music21-rs APIs.