pub struct FretBoard {
pub strings: usize,
pub fret_notes: Vec<FretNote>,
pub display_frets: usize,
pub tuning: Vec<Pitch>,
}Expand description
A fretted instrument’s strings, the notes stopped on them, and their
open pitches: music21’s FretBoard.
Fields§
§strings: usizeHow many strings there are.
fret_notes: Vec<FretNote>The notes stopped, in no particular order.
display_frets: usizeHow many frets a diagram shows.
tuning: Vec<Pitch>Each string’s open pitch, lowest string first.
Implementations§
Source§impl FretBoard
impl FretBoard
Sourcepub fn new(
strings: usize,
fret_notes: Vec<FretNote>,
display_frets: usize,
) -> Self
pub fn new( strings: usize, fret_notes: Vec<FretNote>, display_frets: usize, ) -> Self
A board of so many strings with these notes, not yet tuned.
Sourcepub fn guitar(fret_notes: Vec<FretNote>, display_frets: usize) -> Self
pub fn guitar(fret_notes: Vec<FretNote>, display_frets: usize) -> Self
A guitar’s six strings, E2 A2 D3 G3 B3 E4: music21’s
GuitarFretBoard.
Sourcepub fn ukulele(fret_notes: Vec<FretNote>, display_frets: usize) -> Self
pub fn ukulele(fret_notes: Vec<FretNote>, display_frets: usize) -> Self
A ukulele’s four strings, re-entrant G4 C4 E4 A4: music21’s
UkeleleFretBoard.
Sourcepub fn bass_guitar(fret_notes: Vec<FretNote>, display_frets: usize) -> Self
pub fn bass_guitar(fret_notes: Vec<FretNote>, display_frets: usize) -> Self
A bass guitar’s four strings, E1 A1 D2 G2: music21’s
BassGuitarFretBoard.
Sourcepub fn mandolin(fret_notes: Vec<FretNote>, display_frets: usize) -> Self
pub fn mandolin(fret_notes: Vec<FretNote>, display_frets: usize) -> Self
A mandolin’s four courses, G3 D4 A4 E5: music21’s
MandolinFretBoard.
Sourcepub fn fret_note_by_string(&self, string: IntegerType) -> Option<&FretNote>
pub fn fret_note_by_string(&self, string: IntegerType) -> Option<&FretNote>
The note on a string, the first if several are: music21’s
getFretNoteByString.
Sourcepub fn fret_notes_lowest_first(&self) -> Vec<&FretNote>
pub fn fret_notes_lowest_first(&self) -> Vec<&FretNote>
The note on each string that has one, lowest-sounding string first:
music21’s fretNotesLowestFirst.
Sourcepub fn pitches(&self) -> Result<Vec<Option<Pitch>>>
pub fn pitches(&self) -> Result<Vec<Option<Pitch>>>
The pitch each string sounds, lowest string first, nothing for a
string with no note: music21’s getPitches. A note’s pitch is its
string’s open pitch raised by its fret, spelled as music21 spells a
pitch made from a number. Strings are found as music21 finds them,
counting back from the highest, so a note naming no string is read
as on the lowest.
§Errors
A board whose tuning is not one pitch a string, or a note on a string the board has not got.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FretBoard
Available on crate feature serde only.
impl<'de> Deserialize<'de> for FretBoard
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for FretBoard
Auto Trait Implementations§
impl Freeze for FretBoard
impl RefUnwindSafe for FretBoard
impl Send for FretBoard
impl Sync for FretBoard
impl Unpin for FretBoard
impl UnsafeUnpin for FretBoard
impl UnwindSafe for FretBoard
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more