pub struct Chord {
pub notes: Vec<Note>,
}Expand description
A chord is a collection of notes that are played simultaneously for the same duration.
Fields§
§notes: Vec<Note>Implementations§
Source§impl Chord
impl Chord
pub fn rotate(&self) -> Self
pub fn rotate_by(&self, n: usize) -> Self
Sourcepub fn triad_from_root(
tonality: Tonality,
root: Note,
inversion: Inversion,
) -> Self
pub fn triad_from_root( tonality: Tonality, root: Note, inversion: Inversion, ) -> Self
Creates a trait with a given tonality, root, and inversion.
§Examples
use note_pen::prelude::*;
let chord = Chord::triad_from_root(Tonality::Major, Note::new(Alphabet::C, Accidental::Natural, 4), Inversion::ROOT);
assert_eq!(chord, Note::new(Alphabet::C, Accidental::Natural, 4) +
Note::new(Alphabet::E, Accidental::Natural, 4) +
Note::new(Alphabet::G, Accidental::Natural, 4)
);Sourcepub fn triad_from_base(
tonality: Tonality,
base: Note,
inversion: Inversion,
) -> Self
pub fn triad_from_base( tonality: Tonality, base: Note, inversion: Inversion, ) -> Self
Creates a triad with a given tonality, base, and inversion.
§Examples
use note_pen::prelude::*;
let chord = Chord::triad_from_base(Tonality::Major, Note::new(Alphabet::E, Accidental::Natural, 4), Inversion::ROOT);
assert_eq!(chord, Note::new(Alphabet::E, Accidental::Natural, 4) +
Note::new(Alphabet::G, Accidental::Sharp, 4) +
Note::new(Alphabet::B, Accidental::Natural, 5)
);Trait Implementations§
Auto Trait Implementations§
impl Freeze for Chord
impl RefUnwindSafe for Chord
impl Send for Chord
impl Sync for Chord
impl Unpin for Chord
impl UnwindSafe for Chord
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