Skip to main content

music21_rs/
defaults.rs

1use crate::stepname::StepName;
2use fraction::GenericFraction;
3
4/// Signed integer type used by music21-rs APIs.
5pub type IntegerType = i32;
6/// Unsigned integer type used by count-like music21-rs APIs.
7pub type UnsignedIntegerType = u32;
8/// Floating-point type used for pitch space, quarter lengths, and frequencies.
9pub type FloatType = f64;
10
11/// Fraction type used by ratio and interval helpers.
12pub type FractionType = GenericFraction<IntegerType>;
13
14/// Optional octave number, matching music21's absent-octave representation.
15pub type Octave = Option<IntegerType>;
16
17/// CD track level precision
18pub(crate) const LIMIT_OFFSET_DENOMINATOR: UnsignedIntegerType = 65535;
19
20pub(crate) const PITCH_STEP: StepName = StepName::C;
21pub(crate) const PITCH_OCTAVE: UnsignedIntegerType = 4;
22
23pub(crate) const TWELFTH_ROOT_OF_TWO: FloatType = 1.059_463_1; // 2.0 ** (1 / 12)
24pub(crate) const PITCH_SPACE_SIGNIFICANT_DIGITS: UnsignedIntegerType = 6;