Struct ukebox::voicing::Voicing[][src]

pub struct Voicing { /* fields omitted */ }

Implementations

impl Voicing[src]

The voicing of a chord describes the order of the individual notes within the chord. The same chord can be voiced in different ways, i.e. there are several ways to play the same chord on the ukulele. https://en.wikipedia.org/wiki/Voicing_(music)

pub fn new(fret_pattern: impl Into<FretPattern>, tuning: Tuning) -> Self[src]

pub fn uke_strings(&self) -> Iter<'_, UkeString>[src]

pub fn roots(&self) -> impl Iterator<Item = Note> + '_[src]

pub fn frets(&self) -> impl Iterator<Item = FretID> + '_[src]

pub fn notes(&self) -> impl Iterator<Item = Note> + '_[src]

pub fn count_pressed_strings(&self) -> usize[src]

Return the overall number of strings pressed down when playing this voicing.

pub fn get_min_pressed_fret(&self) -> FretID[src]

Return the lowest fret at which a string is pressed down.

pub fn get_min_fret(&self) -> FretID[src]

Return the lowest fret involved in playing the chord voicing (is 0 if the chord is open).

pub fn get_max_fret(&self) -> FretID[src]

pub fn get_span(&self) -> FretID[src]

pub fn spells_out(&self, chord: &Chord) -> bool[src]

Return true if the voicing contains all the notes needed to play the given chord.

pub fn get_chords(&self) -> Vec<Chord>[src]

pub fn has_barre(&self) -> bool[src]

Return true if the current voicing requires the player to play a barre chord. For this, I took some inspiration from https://github.com/hyvyys/chord-fingering/blob/master/src/barre.js

pub fn fingers_on_strings(&self) -> [u8; 4][src]

Compute a fingering for the current voicing, i.e. assign the player’s fingers to the positions on the fretboard that have to be pressed down. The return value is an array of numbers representing the fingers on the strings (represented by the indexes of the array). This assumes that each chord voicing has a unique fingering (which is not true in reality - often several fingerings are possible). My fingering strategy here is based on my own way to play certain chords. For example, I tend to avoid barre chords if possible, e.g. I play the G major chord as 0132 and not as 0121.

pub fn semitone_distance(&self, other: Voicing) -> u8[src]

Return the distance in semitones between this and another voicing. It’s computed by simply summing up the distances between the frets that are pressed down on the same string when moving from one voicing to the other. Inspired by http://www.petecorey.com/blog/2018/07/30/voice-leading-with-elixir/

pub fn fingering_distance(&self, other: Voicing) -> u8[src]

pub fn distance(&self, other: Voicing) -> Distance[src]

Trait Implementations

impl Clone for Voicing[src]

fn clone(&self) -> Voicing[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Voicing[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for Voicing[src]

The default implementation is used to easily create an “empty” start and end node in the voicing graph.

fn default() -> Self[src]

Returns the “default value” for a type. Read more

impl From<&'_ [(Note, u8, Note)]> for Voicing[src]

fn from(uke_strings: &[UkeString]) -> Self[src]

Performs the conversion.

impl From<Voicing> for Fingering[src]

fn from(voicing: Voicing) -> Self[src]

Performs the conversion.

impl Ord for Voicing[src]

fn cmp(&self, other: &Self) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl PartialEq<Voicing> for Voicing[src]

fn eq(&self, other: &Voicing) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Voicing) -> bool[src]

This method tests for !=.

impl PartialOrd<Voicing> for Voicing[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]

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]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Copy for Voicing[src]

impl Eq for Voicing[src]

impl StructuralEq for Voicing[src]

impl StructuralPartialEq for Voicing[src]

Auto Trait Implementations

impl RefUnwindSafe for Voicing

impl Send for Voicing

impl Sync for Voicing

impl Unpin for Voicing

impl UnwindSafe for Voicing

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

pub fn equivalent(&self, key: &K) -> bool[src]

Compare self to key and return true if they are equal.

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.