Lomse library. API documentation
0.30.0
|
#include <lomse_pitch.h>
Class FPitch is a compact base-40 absolute pitch representation. It is interval-invariant. And is restricted to a maximum of 2 accidentals
FPitch representation has shown to be optimal for representing pitch in cases where music analysis is an objective, as it greatly simplifies the analysis of intervals and chords.
This representation was taken from Walter B. Hewlett paper "A Base-40 Number-line Representation of Musical Pitch Notation", CCARH Publications, Stanford, California, 1986.
Public Member Functions | |
FPitch () | |
FPitch (int value) | |
FPitch (DiatonicPitch dp, int nAcc) | |
FPitch (int nStep, int nOctave, int nAcc) | |
FPitch (const string ¬e) | |
~FPitch () | |
operator int () | |
bool | is_valid () |
bool | is_natural_note_for (EKeySignature nKey) |
bool | operator== (FPitch fp) |
bool | operator!= (FPitch fp) |
bool | operator< (FPitch fp) |
bool | operator> (FPitch fp) |
bool | operator<= (FPitch fp) |
bool | operator>= (FPitch fp) |
int | step () |
int | octave () |
int | num_accidentals () |
EAccidentals | accidentals () |
EAccidentals | notated_accidentals_for (EKeySignature nKey) |
string | to_abs_ldp_name () |
string | to_rel_ldp_name (EKeySignature nKey) |
MidiPitch | to_midi_pitch () |
DiatonicPitch | to_diatonic_pitch () |
FPitch | add_semitone (EKeySignature nKey) |
FPitch | add_semitone (bool fUseSharps) |
FPitch | operator- (FIntval intv) |
FPitch | operator+ (FIntval intv) |
FPitch | operator-= (FIntval intv) |
FPitch | operator+= (FIntval intv) |
|
inline |
Default constructor. Initializes with C4 pitch.
|
inline |
Constructor using an integer representing an FPitch value.
FPitch::FPitch | ( | DiatonicPitch | dp, |
int | nAcc | ||
) |
Constructor using a DiatonicPitch plus accidentals information.
FPitch::FPitch | ( | int | nStep, |
int | nOctave, | ||
int | nAcc | ||
) |
Constructor from pitch components.
FPitch::FPitch | ( | const string & | note | ) |
Constructor from an string representing the pitch in LDP name, e.g., "+c4".
|
inline |
Destructor.
EAccidentals FPitch::accidentals | ( | ) |
Components extraction
FPitch FPitch::add_semitone | ( | EKeySignature | nKey | ) |
Operations
FPitch FPitch::add_semitone | ( | bool | fUseSharps | ) |
Operations
bool FPitch::is_natural_note_for | ( | EKeySignature | nKey | ) |
Returns TRUE if pitch is a diatonic note in the given key signature.
bool FPitch::is_valid | ( | ) |
Returns TRUE if pitch value is valid. Invalid pitches correspond to numbers 6, 12, 23, 29 & 35 and all obtained by adding 40, 80, 120, etc. to them.
EAccidentals FPitch::notated_accidentals_for | ( | EKeySignature | nKey | ) |
Components extraction
int FPitch::num_accidentals | ( | ) |
Components extraction
|
inline |
Components extraction
|
inline |
Operator to cast to an int.
|
inline |
Comparison operators
|
inline |
Comparison operators
|
inline |
Comparison operators
|
inline |
Comparison operators
|
inline |
Comparison operators
|
inline |
Comparison operators
|
inline |
Components extraction
string FPitch::to_abs_ldp_name | ( | ) |
Conversion
DiatonicPitch FPitch::to_diatonic_pitch | ( | ) |
Conversion
MidiPitch FPitch::to_midi_pitch | ( | ) |
Conversion
string FPitch::to_rel_ldp_name | ( | EKeySignature | nKey | ) |
Conversion