#include <Note.h>
|
static std::string | ATONAL = "X" |
|
A Note is used to represent the relative duration and pitch of a sound.
https://en.wikipedia.org/wiki/Musical_note
◆ Note() [1/3]
◆ Note() [2/3]
Note::Note |
( |
const std::string & |
name | ) |
|
|
explicit |
Construct of note
- Parameters
-
◆ Note() [3/3]
Construct note from pitch class and octave #
- Parameters
-
pitchClass | of note |
octave | of note |
◆ atonal()
Instantiate an atonal note
- Returns
- atonal note
◆ containsAnyValidNotes()
bool Note::containsAnyValidNotes |
( |
const std::string & |
noteCsv | ) |
|
|
static |
Whether the CSV contains any valid noteCsv
- Parameters
-
- Returns
- true if contains any valid noteCsv
◆ copy()
Note Note::copy |
( |
| ) |
const |
Copies this object to a new Note
- Returns
- new note
◆ delta()
int Note::delta |
( |
const Note & |
target | ) |
const |
Delta +/- semitones from this Note to another Note
- Parameters
-
target | note to get delta to |
- Returns
- delta +/- semitones
◆ ifTonal()
std::optional< Note > Note::ifTonal |
( |
const std::string & |
name | ) |
|
|
static |
Only stream a valid and tonal note, else empty NC sections should not cache notes from the previous section https://www.pivotaltracker.com/story/show/179409784
- Parameters
-
name | of note to test for validity |
- Returns
- valid note stream, or empty stream (if invalid)
◆ ifValid()
std::optional< Note > Note::ifValid |
( |
const std::string & |
name | ) |
|
|
static |
◆ isAtonal()
bool Note::isAtonal |
( |
| ) |
const |
Whether this note is atonal
- Returns
- true if the pitch class is none
◆ isValid()
bool Note::isValid |
( |
const std::string & |
name | ) |
|
|
static |
Whether the current note is valid
- Parameters
-
- Returns
- true if valid
◆ median()
std::optional< Note > Note::median |
( |
std::optional< Note > |
n1, |
|
|
std::optional< Note > |
n2 |
|
) |
| |
|
static |
Return the median note between the two given notes, or just one if the other is null
- Parameters
-
- Returns
- median note between the given two
◆ next()
Get the first occurrence of the given pitch class in the given direction from the current note
- Parameters
-
target | pitch class to seek |
delta | direction (1 or -1) in which to seek |
- Returns
- first note with given pitch class from this
◆ nextDown()
Get the first occurrence of the given pitch class down from the current note
- Parameters
-
target | pitch class to seek |
- Returns
- first note with given pitch class down from this
◆ nextUp()
Get the first occurrence of the given pitch class up from the current note
- Parameters
-
target | pitch class to seek |
- Returns
- first note with given pitch class up from this
◆ of() [1/2]
Note Note::of |
( |
const std::string & |
name | ) |
|
|
static |
Instantiate a note
- Parameters
-
- Returns
- note
◆ of() [2/2]
Instantiate a note by pitch class and octave
- Parameters
-
pitchClass | of note |
octave | of note |
- Returns
- note
◆ operator<()
bool Note::operator< |
( |
const Note & |
other | ) |
const |
Comparison of two notes: this < other
- Parameters
-
- Returns
- true if this is less than other
◆ operator<=()
bool Note::operator<= |
( |
const Note & |
other | ) |
const |
Comparison of two notes: this <= other
- Parameters
-
- Returns
- true if this is less than other
◆ operator==()
bool Note::operator== |
( |
const Note & |
other | ) |
const |
Equality of two notes
- Parameters
-
- Returns
- true if this is equal to other
◆ operator>()
bool Note::operator> |
( |
const Note & |
other | ) |
const |
Comparison of two notes: this > other
- Parameters
-
- Returns
- true if this is less than other
◆ operator>=()
bool Note::operator>= |
( |
const Note & |
other | ) |
const |
Comparison of two notes: this >= other
- Parameters
-
- Returns
- true if this is less than other
◆ setOctaveNearest()
Note Note::setOctaveNearest |
( |
Note |
fromNote | ) |
|
Set the octave of this note to the one that would result in the target note being at most -6 or +5 semitones from the original note.
Here we guarantee that the target note is no more than -6 or +5 semitones away from the original audio note. Note that we are arbitrarily favoring down-pitching versus up-pitching, and that is an aesthetic decision, because it just sounds good.
[#303] Craft calculates drum audio pitch to conform to the allowable note closest to the original note, slightly favoring down-pitching versus up-pitching.
- Parameters
-
fromNote | to set octave nearest to |
- Returns
- this note for chaining
◆ shift()
Note Note::shift |
( |
int |
inc | ) |
const |
Note stepped +/- semitones to a new Note
- Parameters
-
inc | +/- semitones to transpose |
- Returns
- Note
◆ shiftOctave()
Note Note::shiftOctave |
( |
int |
inc | ) |
const |
Note stepped +/- octaves to a new Note
- Parameters
-
inc | +/- octaves to transpose |
- Returns
- Note
◆ toString()
std::string Note::toString |
( |
Accidental |
accidental | ) |
const |
Note to std::string
- Parameters
-
accidental | to represent note with |
- Returns
- string representation of Note
◆ ATONAL
std::string Note::ATONAL = "X" |
|
static |
Atonal note string representation
◆ octave
◆ pitchClass
The documentation for this class was generated from the following files:
- /home/runner/work/xjmusic/xjmusic/engine/include/xjmusic/music/Note.h
- /home/runner/work/xjmusic/xjmusic/engine/src/music/Note.cpp