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 midi;
32/// Note construction and pitch access helpers.
33pub mod note;
34/// Pitch construction, spelling and pitch-space helpers.
35pub mod pitch;
36/// Polyrhythm timing and pitch-set helpers.
37pub mod polyrhythm;
38/// Silent duration-bearing musical event.
39pub mod rest;
40/// Roman numeral parsing and compact harmonic analysis.
41pub mod roman;
42/// Public scale helpers.
43pub mod scale;
44pub(crate) mod stepname;
45/// Small ordered timeline container.
46pub mod stream;
47/// Tuning-system ratios, labels and frequency helpers.
48pub mod tuningsystem;
49// #[macro_use]
50// pub(crate) mod macros;
51
52pub use abc::{
53    abc_chord, abc_duration, abc_note, abc_rest, pitch_name_from_abc_note,
54    pitch_names_from_abc_chord,
55};
56pub use analysis::{KeyEstimate, estimate_key_from_chords, estimate_key_from_pitches};
57pub use chord::{
58    Chord, ChordResolutionSuggestion, GuitarFingering, GuitarStringFingering, GuitarTuning,
59    GuitarTuningString, IntoNotes, KnownChordType,
60};
61pub use chordsymbol::{ChordAlteration, ChordQuality, ChordSymbol};
62pub use defaults::{FloatType, FractionType, IntegerType, Octave, UnsignedIntegerType};
63pub use duration::Duration;
64pub use error::{Error, Result};
65pub use interval::{Interval, IntervalDirection};
66pub use key::{Key, KeySignature};
67pub use midi::{
68    DEFAULT_TICKS_PER_QUARTER, MidiNote, midi_notes_from_stream, read_midi_bytes,
69    read_midi_bytes_with_tempo, stream_from_midi_notes, write_midi_bytes,
70};
71pub use note::{IntoNote, Note};
72pub use pitch::{
73    Accidental, AccidentalSpecifier, CHROMATIC_PITCH_CLASS_NAMES, Microtone, MicrotoneSpecifier,
74    Pitch, PitchClass, PitchClassSpecifier, PitchName, PitchOptions, pitch_class_name,
75};
76pub use polyrhythm::{Polyrhythm, PolyrhythmAnalysis, PolyrhythmEvent, PolyrhythmRatioTone};
77pub use rest::Rest;
78pub use roman::{RomanNumeral, analyze_chord, analyze_chord_with_root};
79pub use scale::DiatonicScale;
80pub use stream::{Stream, StreamElement, StreamEvent};
81pub use tuningsystem::{
82    ALL_TUNING_SYSTEMS, COMMON_TWELVE_TONE_TUNING_SYSTEMS, Fraction, TuningSystem,
83};