pub struct Scale {
pub tonic: Pitch,
pub octave: u8,
pub scale_type: ScaleType,
pub mode: Option<Mode>,
pub intervals: Vec<Interval>,
pub direction: Direction,
}
Expand description
A scale.
Fields§
§tonic: Pitch
The root note of the scale.
octave: u8
The octave of the root note of the scale.
scale_type: ScaleType
The type of scale (diatonic, melodic minor, harmonic minor).
mode: Option<Mode>
The mode of the scale.
intervals: Vec<Interval>
The list of intervals in the scale.
direction: Direction
The direction of the scale, ascending or descending.
Implementations§
Source§impl Scale
impl Scale
Sourcepub fn new(
scale_type: ScaleType,
tonic: Pitch,
octave: u8,
mode: Option<Mode>,
direction: Direction,
) -> Result<Self, ScaleError>
pub fn new( scale_type: ScaleType, tonic: Pitch, octave: u8, mode: Option<Mode>, direction: Direction, ) -> Result<Self, ScaleError>
Create a new scale with a given direction.
Sourcepub fn from_regex_in_direction(
string: &str,
direction: Direction,
) -> Result<Self, ScaleError>
pub fn from_regex_in_direction( string: &str, direction: Direction, ) -> Result<Self, ScaleError>
Parse a scale from a regex.
pub fn from_regex(string: &str) -> Result<Self, ScaleError>
pub fn absolute_intervals(&self) -> Vec<Interval>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scale
impl RefUnwindSafe for Scale
impl Send for Scale
impl Sync for Scale
impl Unpin for Scale
impl UnwindSafe for Scale
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more