pub use IntervalSize::*;
pub mod utils;
mod tests;
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
pub enum IntervalSize {
Unison,
Second,
Third,
Fourth,
Fifth,
Sixth,
Seventh,
}
impl IntervalSize {
pub fn to_diatonic_semitones(&self) -> u8 {
match self {
Unison => 0, Second => 2, Third => 4, Fourth => 5, Fifth => 7, Sixth => 9, Seventh => 11, }
}
pub fn invert(&self) -> Self {
match self {
Unison => Unison,
Second => Seventh,
Third => Sixth,
Fourth => Fifth,
Fifth => Fourth,
Sixth => Third,
Seventh => Second,
}
}
}