6#include "maiacore/note.h"
16 std::vector<Note> _note;
23 std::pair<std::string, bool> analyse()
const;
29 int whiteKeyDistance()
const;
37 Interval(
const std::string& pitch_A =
"C4",
const std::string& pitch_B =
"C4");
51 void setNotes(
const std::string& pitch_A,
const std::string& pitch_B);
87 const bool absoluteValue =
false)
const;
95 int getDiatonicSteps(
const bool useSingleOctave =
true,
const bool absoluteValue =
false)
const;
150 bool isMajor(
const bool useEnharmony =
false)
const;
157 bool isMinor(
const bool useEnharmony =
false)
const;
371 bool isSecond(
const bool useEnharmony =
false)
const;
378 bool isThird(
const bool useEnharmony =
false)
const;
385 bool isFourth(
const bool useEnharmony =
false)
const;
392 bool isFifth(
const bool useEnharmony =
false)
const;
399 bool isSixth(
const bool useEnharmony =
false)
const;
413 bool isOctave(
const bool useEnharmony =
false)
const;
420 bool isNinth(
const bool useEnharmony =
false)
const;
606 int toCents(
const float freqA4 = 440.0f)
const;
Represents a musical interval between two notes, supporting tonal, diatonic, and chromatic analysis.
Definition: interval.h:14
bool isDiminishedOctave(const bool useEnharmony=false) const
Returns true if the interval is a diminished octave.
bool isAnyOctaveMajorSecond(const bool useEnharmony=false) const
Returns true if the interval is a major second in any octave.
bool isAnyOctaveMajorThird(const bool useEnharmony=false) const
Returns true if the interval is a major third in any octave.
bool isAnyOctaveSeventh() const
Returns true if the interval is a generic seventh (any octave).
int getNumSemitones(const bool absoluteValue=false) const
Returns the number of semitones between the notes.
bool isMajorThirdteenth(const bool useEnharmony=false) const
Returns true if the interval is a major thirteenth.
bool isPerfectFourth(const bool useEnharmony=false) const
Returns true if the interval is a perfect fourth.
bool isTonal() const
Returns true if the interval is tonal (major, minor, perfect, etc.).
bool isThirdteenth(const bool useEnharmony=false) const
Returns true if the interval is a thirteenth (major or minor).
bool isPerfectFifth(const bool useEnharmony=false) const
Returns true if the interval is a perfect fifth.
bool isDiminishedFifth(const bool useEnharmony=false) const
Returns true if the interval is a diminished fifth (tritone).
bool isAnyOctaveFifth() const
Returns true if the interval is a generic fifth (any octave).
bool isPerfectOctave(const bool useEnharmony=false) const
Returns true if the interval is a perfect octave.
bool isAnyOctaveOctave() const
Returns true if the interval is a generic octave (any octave).
bool isThird(const bool useEnharmony=false) const
Returns true if the interval is a generic third (major or minor).
int getPitchStepInterval() const
Returns the pitch step interval (e.g., 1 for unison, 2 for second).
bool isFourth(const bool useEnharmony=false) const
Returns true if the interval is a generic fourth (perfect, augmented, or diminished).
bool isMinorSeventh(const bool useEnharmony=false) const
Returns true if the interval is a minor seventh.
bool isMajorNinth(const bool useEnharmony=false) const
Returns true if the interval is a major ninth.
bool isEleventh(const bool useEnharmony=false) const
Returns true if the interval is an eleventh (perfect or sharp).
bool isSeventh(const bool useEnharmony=false) const
Returns true if the interval is a generic seventh (major, minor, or diminished).
bool isAnyOctaveMinorSixth(const bool useEnharmony=false) const
Returns true if the interval is a minor sixth in any octave.
bool isDiminishedUnisson(const bool useEnharmony=false) const
Returns true if the interval is a diminished unison.
bool isMajorSeventh(const bool useEnharmony=false) const
Returns true if the interval is a major seventh.
int getDiatonicSteps(const bool useSingleOctave=true, const bool absoluteValue=false) const
Returns the number of diatonic steps between the notes.
bool isPerfectUnisson(const bool useEnharmony=false) const
Returns true if the interval is a perfect unison.
bool isAnyOctaveThird() const
Returns true if the interval is a generic third (any octave).
bool isAnyOctaveDiminishedSeventh(const bool useEnharmony=false) const
Returns true if the interval is a diminished seventh in any octave.
bool isMajorThird(const bool useEnharmony=false) const
Returns true if the interval is a major third.
bool isFifth(const bool useEnharmony=false) const
Returns true if the interval is a generic fifth (perfect, augmented, or diminished).
bool isAnyOctaveMinorSeventh(const bool useEnharmony=false) const
Returns true if the interval is a minor seventh in any octave.
std::string getDirection() const
Returns the direction of the interval as a string ("asc", "desc", or empty for unison).
bool operator<(const Interval &otherInterval) const
Less-than operator for comparing intervals by number of semitones.
Definition: interval.h:613
bool isAnyOctaveMajorSixth(const bool useEnharmony=false) const
Returns true if the interval is a major sixth in any octave.
bool isSecond(const bool useEnharmony=false) const
Returns true if the interval is a generic second (major or minor).
bool isMinor(const bool useEnharmony=false) const
Returns true if the interval is minor.
void setNotes(const Note ¬e_A, const Note ¬e_B)
Sets the notes of the interval using Note objects.
bool isAugmentedUnisson(const bool useEnharmony=false) const
Returns true if the interval is an augmented unison.
bool isAugmented(const bool useEnharmony=false) const
Returns true if the interval is augmented.
bool isOctave(const bool useEnharmony=false) const
Returns true if the interval is an octave (perfect, augmented, or diminished).
bool isAnyOctaveDiminishedFifth(const bool useEnharmony=false) const
Returns true if the interval is a diminished fifth in any octave.
bool isAnyOctavePerfectOctave(const bool useEnharmony=false) const
Returns true if the interval is a perfect octave in any octave.
bool isPerfectEleventh(const bool useEnharmony=false) const
Returns true if the interval is a perfect eleventh.
bool isMajorSixth(const bool useEnharmony=false) const
Returns true if the interval is a major sixth.
bool isAscendant() const
Returns true if the interval is ascending.
bool isMinorSixth(const bool useEnharmony=false) const
Returns true if the interval is a minor sixth.
bool isMinorNinth(const bool useEnharmony=false) const
Returns true if the interval is a minor ninth.
bool isAnyOctaveMinorSecond(const bool useEnharmony=false) const
Returns true if the interval is a minor second in any octave.
Interval(const std::string &pitch_A="C4", const std::string &pitch_B="C4")
Constructs an Interval from two pitch strings.
std::vector< Note > getNotes() const
Returns the two notes defining the interval.
bool isMinorThirdteenth(const bool useEnharmony=false) const
Returns true if the interval is a minor thirteenth.
bool isAugmentedFifth(const bool useEnharmony=false) const
Returns true if the interval is an augmented fifth.
bool isMajor(const bool useEnharmony=false) const
Returns true if the interval is major.
bool isAugmentedOctave(const bool useEnharmony=false) const
Returns true if the interval is an augmented octave.
bool isAnyOctaveAugmentedFourth(const bool useEnharmony=false) const
Returns true if the interval is an augmented fourth in any octave.
bool isAugmentedFourth(const bool useEnharmony=false) const
Returns true if the interval is an augmented fourth (tritone).
bool isCompound() const
Returns true if the interval is compound (greater than an octave).
bool isSimple() const
Returns true if the interval is simple (within an octave).
bool isMajorSecond(const bool useEnharmony=false) const
Returns true if the interval is a major second.
bool isAnyOctaveAugmentedOctave(const bool useEnharmony=false) const
Returns true if the interval is an augmented octave in any octave.
int getNumOctaves(const bool absoluteValue=false) const
Returns the number of octaves between the notes.
int getDiatonicInterval(const bool useSingleOctave=true, const bool absoluteValue=false) const
Returns the diatonic interval number (e.g., 3 for a third).
bool isAnyOctavePerfectFifth(const bool useEnharmony=false) const
Returns true if the interval is a perfect fifth in any octave.
bool isAnyOctaveDiminishedOctave(const bool useEnharmony=false) const
Returns true if the interval is a diminished octave in any octave.
bool isDiminishedSeventh(const bool useEnharmony=false) const
Returns true if the interval is a diminished seventh.
bool isMinorSecond(const bool useEnharmony=false) const
Returns true if the interval is a minor second.
bool isSixth(const bool useEnharmony=false) const
Returns true if the interval is a generic sixth (major or minor).
bool isDiminished(const bool useEnharmony=false) const
Returns true if the interval is diminished.
void setNotes(const std::string &pitch_A, const std::string &pitch_B)
Sets the notes of the interval using pitch strings.
bool isAnyOctaveSecond() const
Returns true if the interval is a generic second (any octave).
bool isDescendant() const
Returns true if the interval is descending.
bool isPerfect(const bool useEnharmony=false) const
Returns true if the interval is perfect.
bool isMinorThird(const bool useEnharmony=false) const
Returns true if the interval is a minor third.
bool isSharpEleventh(const bool useEnharmony=false) const
Returns true if the interval is a sharp eleventh.
bool isAnyOctaveSixth() const
Returns true if the interval is a generic sixth (any octave).
int toCents(const float freqA4=440.0f) const
Returns the interval size in cents (for microtonal/tuning analysis).
bool isAnyOctaveMajorSeventh(const bool useEnharmony=false) const
Returns true if the interval is a major seventh in any octave.
bool isAnyOctaveFourth() const
Returns true if the interval is a generic fourth (any octave).
bool isAnyOctaveMinorThird(const bool useEnharmony=false) const
Returns true if the interval is a minor third in any octave.
Interval(const Note ¬e_A, const Note ¬e_B)
Constructs an Interval from two Note objects.
bool isNinth(const bool useEnharmony=false) const
Returns true if the interval is a ninth (major or minor).
bool isAnyOctaveAugmentedFifth(const bool useEnharmony=false) const
Returns true if the interval is an augmented fifth in any octave.
bool isAnyOctavePerfectFourth(const bool useEnharmony=false) const
Returns true if the interval is a perfect fourth in any octave.
std::string getName() const
Returns the interval name (e.g., "M3", "P5", "m2").
Represents a musical note, including pitch, duration, articulation, and MusicXML-related attributes.
Definition: note.h:19