Skip to main content

music21_rs/
lib.rs

1// The port still carries internal music21 compatibility scaffolding that is
2// intentionally exposed only as APIs fill in.
3#![allow(dead_code)]
4//! Rust helpers inspired by selected parts of Python's `music21`.
5//!
6//! The crate currently focuses on pitch construction, chord naming and
7//! lightweight theory utilities such as polyrhythm and tuning-system helpers.
8// #![feature(inline_const_pat)]
9// #![feature(negative_impls)]
10// #![feature(specialization)]
11// #![feature(lazy_get)]
12/// ABC notation export helpers.
13pub mod abc;
14/// Key-finding and compact analysis helpers.
15pub mod analysis;
16pub(crate) mod base;
17/// Chord construction, common-name analysis and chord input conversion traits.
18pub mod chord;
19/// Lead-sheet chord-symbol parsing.
20pub mod chordsymbol;
21pub(crate) mod common;
22pub(crate) mod defaults;
23pub(crate) mod display;
24/// Rhythmic duration primitives.
25pub mod duration;
26/// Error and result types used by the crate.
27pub mod error;
28
29pub(crate) mod fraction_pow;
30/// Public interval parsing, naming and transposition helpers.
31pub mod interval;
32/// Public key and key-signature helpers.
33pub mod key;
34/// Minimal MIDI import/export helpers.
35pub mod midi;
36/// Note construction and pitch access helpers.
37pub mod note;
38/// Pitch construction, spelling and pitch-space helpers.
39pub mod pitch;
40/// Polyrhythm timing and pitch-set helpers.
41pub mod polyrhythm;
42pub(crate) mod prebase;
43/// Silent duration-bearing musical event.
44pub mod rest;
45/// Roman numeral parsing and compact harmonic analysis.
46pub mod roman;
47/// Public scale helpers.
48pub mod scale;
49pub(crate) mod stepname;
50/// Small ordered timeline container.
51pub mod stream;
52/// Tuning-system ratios, labels and frequency helpers.
53pub mod tuningsystem;
54// #[macro_use]
55// pub(crate) mod macros;
56
57pub use abc::{
58    AbcClef, abc_chord, abc_chord_document, abc_chord_resolution_document, abc_clef_for_pitches,
59    abc_duration, abc_note, abc_polyrhythm_document, abc_polyrhythm_voice,
60};
61pub use analysis::{KeyEstimate, estimate_key_from_chords, estimate_key_from_pitches};
62pub use chord::{
63    Chord, ChordResolutionSuggestion, GuitarFingering, GuitarStringFingering, GuitarTuning,
64    GuitarTuningString, IntoNotes, KnownChordType,
65};
66pub use chordsymbol::{ChordAlteration, ChordQuality, ChordSymbol};
67pub use defaults::{FloatType, FractionType, IntegerType, Octave, UnsignedIntegerType};
68pub use duration::Duration;
69pub use error::{Error, Result};
70pub use interval::{Interval, IntervalDirection};
71pub use key::{Key, KeySignature};
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::DiatonicScale;
85pub use stream::{Stream, StreamElement, StreamEvent};
86pub use tuningsystem::{
87    ALL_TUNING_SYSTEMS, COMMON_TWELVE_TONE_TUNING_SYSTEMS, Fraction, TuningSystem,
88};