Skip to main content

music21_rs/
lib.rs

1//! Rust helpers inspired by selected parts of Python's `music21`.
2//!
3//! The crate currently focuses on pitch construction, chord naming and
4//! lightweight theory utilities such as polyrhythm and tuning-system helpers.
5// #![feature(inline_const_pat)]
6// #![feature(negative_impls)]
7// #![feature(specialization)]
8// #![feature(lazy_get)]
9/// ABC notation export helpers.
10pub mod abc;
11/// Key-finding and compact analysis helpers.
12pub mod analysis;
13/// Chord construction, common-name analysis and chord input conversion traits.
14pub mod chord;
15/// Lead-sheet chord-symbol parsing.
16pub mod chordsymbol;
17pub(crate) mod common;
18pub(crate) mod defaults;
19pub(crate) mod display;
20/// Rhythmic duration primitives.
21pub mod duration;
22/// Error and result types used by the crate.
23pub mod error;
24
25pub(crate) mod fraction_pow;
26/// Public interval parsing, naming and transposition helpers.
27pub mod interval;
28/// Public key and key-signature helpers.
29pub mod key;
30/// Minimal MIDI import/export helpers.
31pub mod meter;
32pub mod midi;
33/// Note construction and pitch access helpers.
34pub mod note;
35/// Pitch construction, spelling and pitch-space helpers.
36pub mod pitch;
37/// Polyrhythm timing and pitch-set helpers.
38pub mod polyrhythm;
39/// Silent duration-bearing musical event.
40pub mod rest;
41/// Roman numeral parsing and compact harmonic analysis.
42pub mod roman;
43/// Public scale helpers.
44pub mod scale;
45pub mod sieve;
46pub(crate) mod stepname;
47/// Small ordered timeline container.
48pub mod stream;
49/// Tuning-system ratios, labels and frequency helpers.
50pub mod tuningsystem;
51// #[macro_use]
52// pub(crate) mod macros;
53
54pub use abc::{
55    abc_chord, abc_duration, abc_note, abc_rest, pitch_name_from_abc_note,
56    pitch_names_from_abc_chord,
57};
58pub use analysis::{KeyEstimate, estimate_key_from_chords, estimate_key_from_pitches};
59pub use chord::{
60    Chord, ChordResolutionSuggestion, GuitarFingering, GuitarStringFingering, GuitarTuning,
61    GuitarTuningString, IntoNotes, KnownChordType,
62};
63pub use chordsymbol::{
64    ChordAlteration, ChordQuality, ChordSymbol, Music21ChordType, known_chord_symbol_types,
65};
66pub use defaults::{FloatType, FractionType, IntegerType, Octave, UnsignedIntegerType};
67pub use duration::{Duration, DurationType};
68pub use error::{Error, Result};
69pub use interval::{Interval, IntervalDirection};
70pub use key::{Key, KeySignature};
71pub use meter::{BeatDivision, TimeSignature};
72pub use midi::{
73    DEFAULT_TICKS_PER_QUARTER, MidiNote, midi_notes_from_stream, read_midi_bytes,
74    read_midi_bytes_with_tempo, stream_from_midi_notes, write_midi_bytes,
75};
76pub use note::{IntoNote, Note};
77pub use pitch::{
78    Accidental, AccidentalSpecifier, CHROMATIC_PITCH_CLASS_NAMES, Microtone, MicrotoneSpecifier,
79    Pitch, PitchClass, PitchClassSpecifier, PitchName, PitchOptions, pitch_class_name,
80};
81pub use polyrhythm::{Polyrhythm, PolyrhythmAnalysis, PolyrhythmEvent, PolyrhythmRatioTone};
82pub use rest::Rest;
83pub use roman::{RomanNumeral, analyze_chord, analyze_chord_with_root};
84pub use scale::{BluesForm, DiatonicScale, Scale, ScaleType, StepScale, WeightedHexatonicBlues};
85pub use sieve::Sieve;
86pub use stream::{Stream, StreamElement, StreamEvent};
87pub use tuningsystem::{
88    ALL_TUNING_SYSTEMS, COMMON_EQUAL_TEMPERAMENTS, COMMON_TWELVE_TONE_TUNING_SYSTEMS, Fraction,
89    HISTORICAL_TEMPERAMENTS, TuningSystem,
90    scala::{ScalaArchive, ScalaDegree, ScalaScale},
91};