pub struct Note {
    pub letter: Letter,
    pub octave: i8,
}
Expand description

Note abstraction with letter and octave

Fields

letter: Letteroctave: i8

Implementations

Construct Note from Letter and octave.

The Letter are all letter from A to G with only flat b variations. Octaves can be negatives.

Examples

Basic usage:

use mumuse::music::{note::Note, common::Letter};
let n = Note::new(Letter::A, 4);

Creates Chord with self as root note.

Specify by an &str the type of chord to build.

Examples

Basic usage:

use mumuse::music::{note::Note, common::Letter};
let n = Note::new(Letter::A, 4);
let c = n.chord("maj7");

Compute distance in semitones between two notes.

Examples

Basic usage:

use mumuse::music::{note::Note, common::Letter};
let a = Note::new(Letter::A, 4);
let b = Note::new(Letter::B, 4);
let dist = a.dist_to(&b);

Trait Implementations

Overload operator + for Note + Interval

Adds an Interval to a Note

Examples

Basic usage:

use mumuse::music::{note::Note, common::{Interval, Letter}};
let n = Note::new(Letter::A, 3) + Interval::MinorSecond;

The resulting type after applying the + operator.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Displays a Note

Formats the value using the given formatter. Read more

Overload operator - for Note - Interval

Subtracts an Interval to a Note

Examples

Basic usage:

use mumuse::music::{note::Note, common::{Interval, Letter}};
let n = Note::new(Letter::A, 3) - Interval::MinorSecond;

The resulting type after applying the - operator.

Conversion from Data::KeyNumber.

Examples

Basic usage:

use mumuse::messages::Data;
use mumuse::music::note::Note;
let kn = Data::KeyNumber(44);
let n = Note::try_from(&kn);

The type returned in the event of a conversion error.

Performs the conversion.

Conversion from &str.

Examples

Basic usage:

use mumuse::music::note::Note;
let n = Note::try_from("A3"); // Is a Result

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

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

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.