Struct persichetti::primitives::PitchedNote [−][src]
pub struct PitchedNote { /* fields omitted */ }
A pitched note represents a Note
in a definite octave. C4 is “middle C”
and A0 is the lowest note on a standard piano
Implementations
impl PitchedNote
[src]
impl PitchedNote
[src]Represents a Note
in absolute pitch space, known as Scientific Pitch.
Each instance of the struct will contain a note and its corresponding octave. Middle C is C4 in this implementation.
Keep in mind that the letter name of the note is what determines its octave, i.e. C5 and C♭5 are a
half step apart. Functions are also provided to convert between scientific pitch and MIDI numbering.
pub fn from_note(note: Note, octave: isize) -> PitchedNote
[src]
pub fn new(name: NoteName, accidental: Accidental, octave: isize) -> PitchedNote
[src]
pub fn from_str(input: &str) -> Result<PitchedNote, NoteError>
[src]
pub fn from_str(input: &str) -> Result<PitchedNote, NoteError>
[src]Instantiate using the same shorthand as a normal Note
documented in crate::primitives
, but
using an additional octave indicator.
pub fn midi_number(&self) -> isize
[src]
pub fn midi_number(&self) -> isize
[src]Converts a PitchedNote
to its corresponding number in MIDI, where A0 (the lowest note
on a standard piano) is 21. The octave of the note is determined by its letter name, meaning for
example that C1 is 24 and C♭1 is 23, even though B0 is also 23.
pub fn chromatic_distance(&self, other: &Self) -> usize
[src]
pub fn chromatic_distance(&self, other: &Self) -> usize
[src]The number of half-steps (semitones) separating two pitches
pub fn simple_interval(&self, other: &Self) -> Interval
[src]
pub fn simple_interval(&self, other: &Self) -> Interval
[src]The interval between one PitchedNote
and another, without any octave information
pub fn compound_interval(&self, other: &Self) -> CompoundInterval
[src]
pub fn compound_interval(&self, other: &Self) -> CompoundInterval
[src]The interval between one PitchedNote
and another, including how many octaves separate them. Notes in the
same octave (less than 12 half-steps apart) will have an octave of zero. Of note is that there is no
diminished octave in this naming system. The distance between, say, G♯5 and
G♮6 is indicated as a diminished unison with an octave of one. This was an intentional
choice, made because an octave is equivalent to a unison for analytical purposes.
Trait Implementations
impl Clone for PitchedNote
[src]
impl Clone for PitchedNote
[src]fn clone(&self) -> PitchedNote
[src]
fn clone(&self) -> PitchedNote
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for PitchedNote
[src]
impl Debug for PitchedNote
[src]impl Display for PitchedNote
[src]
impl Display for PitchedNote
[src]impl Hash for PitchedNote
[src]
impl Hash for PitchedNote
[src]impl Ord for PitchedNote
[src]
impl Ord for PitchedNote
[src]impl PartialEq<PitchedNote> for PitchedNote
[src]
impl PartialEq<PitchedNote> for PitchedNote
[src]fn eq(&self, other: &PitchedNote) -> bool
[src]
fn eq(&self, other: &PitchedNote) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &PitchedNote) -> bool
[src]
fn ne(&self, other: &PitchedNote) -> bool
[src]This method tests for !=
.
impl PartialOrd<PitchedNote> for PitchedNote
[src]
impl PartialOrd<PitchedNote> for PitchedNote
[src]fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for PitchedNote
[src]
impl StructuralEq for PitchedNote
[src]
impl StructuralPartialEq for PitchedNote
[src]
Auto Trait Implementations
impl RefUnwindSafe for PitchedNote
impl Send for PitchedNote
impl Sync for PitchedNote
impl Unpin for PitchedNote
impl UnwindSafe for PitchedNote
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more