maiacore 1.10.1
Music analisys library
Interval Class Reference

Represents a musical interval between two notes, supporting tonal, diatonic, and chromatic analysis. More...

#include <interval.h>

Public Member Functions

 Interval (const std::string &pitch_A="C4", const std::string &pitch_B="C4")
 Constructs an Interval from two pitch strings. More...
 
 Interval (const Note &note_A, const Note &note_B)
 Constructs an Interval from two Note objects. More...
 
void setNotes (const std::string &pitch_A, const std::string &pitch_B)
 Sets the notes of the interval using pitch strings. More...
 
void setNotes (const Note &note_A, const Note &note_B)
 Sets the notes of the interval using Note objects. More...
 
std::string getName () const
 Returns the interval name (e.g., "M3", "P5", "m2"). More...
 
int getNumSemitones (const bool absoluteValue=false) const
 Returns the number of semitones between the notes. More...
 
int getNumOctaves (const bool absoluteValue=false) const
 Returns the number of octaves between the notes. More...
 
int getDiatonicInterval (const bool useSingleOctave=true, const bool absoluteValue=false) const
 Returns the diatonic interval number (e.g., 3 for a third). More...
 
int getDiatonicSteps (const bool useSingleOctave=true, const bool absoluteValue=false) const
 Returns the number of diatonic steps between the notes. More...
 
int getPitchStepInterval () const
 Returns the pitch step interval (e.g., 1 for unison, 2 for second). More...
 
std::vector< NotegetNotes () const
 Returns the two notes defining the interval. More...
 
bool isAscendant () const
 Returns true if the interval is ascending. More...
 
bool isDescendant () const
 Returns true if the interval is descending. More...
 
std::string getDirection () const
 Returns the direction of the interval as a string ("asc", "desc", or empty for unison). More...
 
bool isSimple () const
 Returns true if the interval is simple (within an octave). More...
 
bool isCompound () const
 Returns true if the interval is compound (greater than an octave). More...
 
bool isTonal () const
 Returns true if the interval is tonal (major, minor, perfect, etc.). More...
 
bool isMajor (const bool useEnharmony=false) const
 Returns true if the interval is major. More...
 
bool isMinor (const bool useEnharmony=false) const
 Returns true if the interval is minor. More...
 
bool isPerfect (const bool useEnharmony=false) const
 Returns true if the interval is perfect. More...
 
bool isDiminished (const bool useEnharmony=false) const
 Returns true if the interval is diminished. More...
 
bool isAugmented (const bool useEnharmony=false) const
 Returns true if the interval is augmented. More...
 
bool isDiminishedUnisson (const bool useEnharmony=false) const
 Returns true if the interval is a diminished unison. More...
 
bool isPerfectUnisson (const bool useEnharmony=false) const
 Returns true if the interval is a perfect unison. More...
 
bool isAugmentedUnisson (const bool useEnharmony=false) const
 Returns true if the interval is an augmented unison. More...
 
bool isMinorSecond (const bool useEnharmony=false) const
 Returns true if the interval is a minor second. More...
 
bool isMajorSecond (const bool useEnharmony=false) const
 Returns true if the interval is a major second. More...
 
bool isMinorThird (const bool useEnharmony=false) const
 Returns true if the interval is a minor third. More...
 
bool isMajorThird (const bool useEnharmony=false) const
 Returns true if the interval is a major third. More...
 
bool isPerfectFourth (const bool useEnharmony=false) const
 Returns true if the interval is a perfect fourth. More...
 
bool isAugmentedFourth (const bool useEnharmony=false) const
 Returns true if the interval is an augmented fourth (tritone). More...
 
bool isDiminishedFifth (const bool useEnharmony=false) const
 Returns true if the interval is a diminished fifth (tritone). More...
 
bool isPerfectFifth (const bool useEnharmony=false) const
 Returns true if the interval is a perfect fifth. More...
 
bool isAugmentedFifth (const bool useEnharmony=false) const
 Returns true if the interval is an augmented fifth. More...
 
bool isMinorSixth (const bool useEnharmony=false) const
 Returns true if the interval is a minor sixth. More...
 
bool isMajorSixth (const bool useEnharmony=false) const
 Returns true if the interval is a major sixth. More...
 
bool isDiminishedSeventh (const bool useEnharmony=false) const
 Returns true if the interval is a diminished seventh. More...
 
bool isMinorSeventh (const bool useEnharmony=false) const
 Returns true if the interval is a minor seventh. More...
 
bool isMajorSeventh (const bool useEnharmony=false) const
 Returns true if the interval is a major seventh. More...
 
bool isDiminishedOctave (const bool useEnharmony=false) const
 Returns true if the interval is a diminished octave. More...
 
bool isPerfectOctave (const bool useEnharmony=false) const
 Returns true if the interval is a perfect octave. More...
 
bool isAugmentedOctave (const bool useEnharmony=false) const
 Returns true if the interval is an augmented octave. More...
 
bool isMinorNinth (const bool useEnharmony=false) const
 Returns true if the interval is a minor ninth. More...
 
bool isMajorNinth (const bool useEnharmony=false) const
 Returns true if the interval is a major ninth. More...
 
bool isPerfectEleventh (const bool useEnharmony=false) const
 Returns true if the interval is a perfect eleventh. More...
 
bool isSharpEleventh (const bool useEnharmony=false) const
 Returns true if the interval is a sharp eleventh. More...
 
bool isMinorThirdteenth (const bool useEnharmony=false) const
 Returns true if the interval is a minor thirteenth. More...
 
bool isMajorThirdteenth (const bool useEnharmony=false) const
 Returns true if the interval is a major thirteenth. More...
 
bool isSecond (const bool useEnharmony=false) const
 Returns true if the interval is a generic second (major or minor). More...
 
bool isThird (const bool useEnharmony=false) const
 Returns true if the interval is a generic third (major or minor). More...
 
bool isFourth (const bool useEnharmony=false) const
 Returns true if the interval is a generic fourth (perfect, augmented, or diminished). More...
 
bool isFifth (const bool useEnharmony=false) const
 Returns true if the interval is a generic fifth (perfect, augmented, or diminished). More...
 
bool isSixth (const bool useEnharmony=false) const
 Returns true if the interval is a generic sixth (major or minor). More...
 
bool isSeventh (const bool useEnharmony=false) const
 Returns true if the interval is a generic seventh (major, minor, or diminished). More...
 
bool isOctave (const bool useEnharmony=false) const
 Returns true if the interval is an octave (perfect, augmented, or diminished). More...
 
bool isNinth (const bool useEnharmony=false) const
 Returns true if the interval is a ninth (major or minor). More...
 
bool isEleventh (const bool useEnharmony=false) const
 Returns true if the interval is an eleventh (perfect or sharp). More...
 
bool isThirdteenth (const bool useEnharmony=false) const
 Returns true if the interval is a thirteenth (major or minor). More...
 
bool isAnyOctaveMinorSecond (const bool useEnharmony=false) const
 Returns true if the interval is a minor second in any octave. More...
 
bool isAnyOctaveMajorSecond (const bool useEnharmony=false) const
 Returns true if the interval is a major second in any octave. More...
 
bool isAnyOctaveMinorThird (const bool useEnharmony=false) const
 Returns true if the interval is a minor third in any octave. More...
 
bool isAnyOctaveMajorThird (const bool useEnharmony=false) const
 Returns true if the interval is a major third in any octave. More...
 
bool isAnyOctavePerfectFourth (const bool useEnharmony=false) const
 Returns true if the interval is a perfect fourth in any octave. More...
 
bool isAnyOctaveAugmentedFourth (const bool useEnharmony=false) const
 Returns true if the interval is an augmented fourth in any octave. More...
 
bool isAnyOctaveDiminishedFifth (const bool useEnharmony=false) const
 Returns true if the interval is a diminished fifth in any octave. More...
 
bool isAnyOctavePerfectFifth (const bool useEnharmony=false) const
 Returns true if the interval is a perfect fifth in any octave. More...
 
bool isAnyOctaveAugmentedFifth (const bool useEnharmony=false) const
 Returns true if the interval is an augmented fifth in any octave. More...
 
bool isAnyOctaveMinorSixth (const bool useEnharmony=false) const
 Returns true if the interval is a minor sixth in any octave. More...
 
bool isAnyOctaveMajorSixth (const bool useEnharmony=false) const
 Returns true if the interval is a major sixth in any octave. More...
 
bool isAnyOctaveDiminishedSeventh (const bool useEnharmony=false) const
 Returns true if the interval is a diminished seventh in any octave. More...
 
bool isAnyOctaveMinorSeventh (const bool useEnharmony=false) const
 Returns true if the interval is a minor seventh in any octave. More...
 
bool isAnyOctaveMajorSeventh (const bool useEnharmony=false) const
 Returns true if the interval is a major seventh in any octave. More...
 
bool isAnyOctaveDiminishedOctave (const bool useEnharmony=false) const
 Returns true if the interval is a diminished octave in any octave. More...
 
bool isAnyOctavePerfectOctave (const bool useEnharmony=false) const
 Returns true if the interval is a perfect octave in any octave. More...
 
bool isAnyOctaveAugmentedOctave (const bool useEnharmony=false) const
 Returns true if the interval is an augmented octave in any octave. More...
 
bool isAnyOctaveSecond () const
 Returns true if the interval is a generic second (any octave). More...
 
bool isAnyOctaveThird () const
 Returns true if the interval is a generic third (any octave). More...
 
bool isAnyOctaveFourth () const
 Returns true if the interval is a generic fourth (any octave). More...
 
bool isAnyOctaveFifth () const
 Returns true if the interval is a generic fifth (any octave). More...
 
bool isAnyOctaveSixth () const
 Returns true if the interval is a generic sixth (any octave). More...
 
bool isAnyOctaveSeventh () const
 Returns true if the interval is a generic seventh (any octave). More...
 
bool isAnyOctaveOctave () const
 Returns true if the interval is a generic octave (any octave). More...
 
int toCents (const float freqA4=440.0f) const
 Returns the interval size in cents (for microtonal/tuning analysis). More...
 
bool operator< (const Interval &otherInterval) const
 Less-than operator for comparing intervals by number of semitones. More...
 

Detailed Description

Represents a musical interval between two notes, supporting tonal, diatonic, and chromatic analysis.

The Interval class provides methods for constructing, analyzing, and classifying musical intervals. It supports both pitch string and Note object input, and offers detailed intervallic queries for music analysis and computational musicology.

Constructor & Destructor Documentation

◆ Interval() [1/2]

Interval::Interval ( const std::string &  pitch_A = "C4",
const std::string &  pitch_B = "C4" 
)

Constructs an Interval from two pitch strings.

Parameters
pitch_AFirst pitch string (default: "C4").
pitch_BSecond pitch string (default: "C4").

◆ Interval() [2/2]

Interval::Interval ( const Note note_A,
const Note note_B 
)

Constructs an Interval from two Note objects.

Parameters
note_AFirst Note.
note_BSecond Note.

Member Function Documentation

◆ getDiatonicInterval()

int Interval::getDiatonicInterval ( const bool  useSingleOctave = true,
const bool  absoluteValue = false 
) const

Returns the diatonic interval number (e.g., 3 for a third).

Parameters
useSingleOctaveIf true, computes within a single octave.
absoluteValueIf true, returns absolute value.
Returns
Diatonic interval number.

◆ getDiatonicSteps()

int Interval::getDiatonicSteps ( const bool  useSingleOctave = true,
const bool  absoluteValue = false 
) const

Returns the number of diatonic steps between the notes.

Parameters
useSingleOctaveIf true, computes within a single octave.
absoluteValueIf true, returns absolute value.
Returns
Number of diatonic steps.

◆ getDirection()

std::string Interval::getDirection ( ) const

Returns the direction of the interval as a string ("asc", "desc", or empty for unison).

Returns
Direction string.

◆ getName()

std::string Interval::getName ( ) const

Returns the interval name (e.g., "M3", "P5", "m2").

Returns
String with the interval name.

◆ getNotes()

std::vector< Note > Interval::getNotes ( ) const

Returns the two notes defining the interval.

Returns
Vector of Note objects.

◆ getNumOctaves()

int Interval::getNumOctaves ( const bool  absoluteValue = false) const

Returns the number of octaves between the notes.

Parameters
absoluteValueIf true, returns absolute value.
Returns
Number of octaves.

◆ getNumSemitones()

int Interval::getNumSemitones ( const bool  absoluteValue = false) const

Returns the number of semitones between the notes.

Parameters
absoluteValueIf true, returns absolute value.
Returns
Number of semitones.

◆ getPitchStepInterval()

int Interval::getPitchStepInterval ( ) const

Returns the pitch step interval (e.g., 1 for unison, 2 for second).

Returns
Pitch step interval as integer.

◆ isAnyOctaveAugmentedFifth()

bool Interval::isAnyOctaveAugmentedFifth ( const bool  useEnharmony = false) const

Returns true if the interval is an augmented fifth in any octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if any-octave augmented fifth.

◆ isAnyOctaveAugmentedFourth()

bool Interval::isAnyOctaveAugmentedFourth ( const bool  useEnharmony = false) const

Returns true if the interval is an augmented fourth in any octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if any-octave augmented fourth.

◆ isAnyOctaveAugmentedOctave()

bool Interval::isAnyOctaveAugmentedOctave ( const bool  useEnharmony = false) const

Returns true if the interval is an augmented octave in any octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if any-octave augmented octave.

◆ isAnyOctaveDiminishedFifth()

bool Interval::isAnyOctaveDiminishedFifth ( const bool  useEnharmony = false) const

Returns true if the interval is a diminished fifth in any octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if any-octave diminished fifth.

◆ isAnyOctaveDiminishedOctave()

bool Interval::isAnyOctaveDiminishedOctave ( const bool  useEnharmony = false) const

Returns true if the interval is a diminished octave in any octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if any-octave diminished octave.

◆ isAnyOctaveDiminishedSeventh()

bool Interval::isAnyOctaveDiminishedSeventh ( const bool  useEnharmony = false) const

Returns true if the interval is a diminished seventh in any octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if any-octave diminished seventh.

◆ isAnyOctaveFifth()

bool Interval::isAnyOctaveFifth ( ) const

Returns true if the interval is a generic fifth (any octave).

Returns
True if any-octave fifth.

◆ isAnyOctaveFourth()

bool Interval::isAnyOctaveFourth ( ) const

Returns true if the interval is a generic fourth (any octave).

Returns
True if any-octave fourth.

◆ isAnyOctaveMajorSecond()

bool Interval::isAnyOctaveMajorSecond ( const bool  useEnharmony = false) const

Returns true if the interval is a major second in any octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if any-octave major second.

◆ isAnyOctaveMajorSeventh()

bool Interval::isAnyOctaveMajorSeventh ( const bool  useEnharmony = false) const

Returns true if the interval is a major seventh in any octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if any-octave major seventh.

◆ isAnyOctaveMajorSixth()

bool Interval::isAnyOctaveMajorSixth ( const bool  useEnharmony = false) const

Returns true if the interval is a major sixth in any octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if any-octave major sixth.

◆ isAnyOctaveMajorThird()

bool Interval::isAnyOctaveMajorThird ( const bool  useEnharmony = false) const

Returns true if the interval is a major third in any octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if any-octave major third.

◆ isAnyOctaveMinorSecond()

bool Interval::isAnyOctaveMinorSecond ( const bool  useEnharmony = false) const

Returns true if the interval is a minor second in any octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if any-octave minor second.

◆ isAnyOctaveMinorSeventh()

bool Interval::isAnyOctaveMinorSeventh ( const bool  useEnharmony = false) const

Returns true if the interval is a minor seventh in any octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if any-octave minor seventh.

◆ isAnyOctaveMinorSixth()

bool Interval::isAnyOctaveMinorSixth ( const bool  useEnharmony = false) const

Returns true if the interval is a minor sixth in any octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if any-octave minor sixth.

◆ isAnyOctaveMinorThird()

bool Interval::isAnyOctaveMinorThird ( const bool  useEnharmony = false) const

Returns true if the interval is a minor third in any octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if any-octave minor third.

◆ isAnyOctaveOctave()

bool Interval::isAnyOctaveOctave ( ) const

Returns true if the interval is a generic octave (any octave).

Returns
True if any-octave octave.

◆ isAnyOctavePerfectFifth()

bool Interval::isAnyOctavePerfectFifth ( const bool  useEnharmony = false) const

Returns true if the interval is a perfect fifth in any octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if any-octave perfect fifth.

◆ isAnyOctavePerfectFourth()

bool Interval::isAnyOctavePerfectFourth ( const bool  useEnharmony = false) const

Returns true if the interval is a perfect fourth in any octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if any-octave perfect fourth.

◆ isAnyOctavePerfectOctave()

bool Interval::isAnyOctavePerfectOctave ( const bool  useEnharmony = false) const

Returns true if the interval is a perfect octave in any octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if any-octave perfect octave.

◆ isAnyOctaveSecond()

bool Interval::isAnyOctaveSecond ( ) const

Returns true if the interval is a generic second (any octave).

Returns
True if any-octave second.

◆ isAnyOctaveSeventh()

bool Interval::isAnyOctaveSeventh ( ) const

Returns true if the interval is a generic seventh (any octave).

Returns
True if any-octave seventh.

◆ isAnyOctaveSixth()

bool Interval::isAnyOctaveSixth ( ) const

Returns true if the interval is a generic sixth (any octave).

Returns
True if any-octave sixth.

◆ isAnyOctaveThird()

bool Interval::isAnyOctaveThird ( ) const

Returns true if the interval is a generic third (any octave).

Returns
True if any-octave third.

◆ isAscendant()

bool Interval::isAscendant ( ) const

Returns true if the interval is ascending.

Returns
True if ascending.

◆ isAugmented()

bool Interval::isAugmented ( const bool  useEnharmony = false) const

Returns true if the interval is augmented.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if augmented.

◆ isAugmentedFifth()

bool Interval::isAugmentedFifth ( const bool  useEnharmony = false) const

Returns true if the interval is an augmented fifth.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if augmented fifth.

◆ isAugmentedFourth()

bool Interval::isAugmentedFourth ( const bool  useEnharmony = false) const

Returns true if the interval is an augmented fourth (tritone).

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if augmented fourth.

◆ isAugmentedOctave()

bool Interval::isAugmentedOctave ( const bool  useEnharmony = false) const

Returns true if the interval is an augmented octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if augmented octave.

◆ isAugmentedUnisson()

bool Interval::isAugmentedUnisson ( const bool  useEnharmony = false) const

Returns true if the interval is an augmented unison.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if augmented unison.

◆ isCompound()

bool Interval::isCompound ( ) const

Returns true if the interval is compound (greater than an octave).

Returns
True if compound.

◆ isDescendant()

bool Interval::isDescendant ( ) const

Returns true if the interval is descending.

Returns
True if descending.

◆ isDiminished()

bool Interval::isDiminished ( const bool  useEnharmony = false) const

Returns true if the interval is diminished.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if diminished.

◆ isDiminishedFifth()

bool Interval::isDiminishedFifth ( const bool  useEnharmony = false) const

Returns true if the interval is a diminished fifth (tritone).

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if diminished fifth.

◆ isDiminishedOctave()

bool Interval::isDiminishedOctave ( const bool  useEnharmony = false) const

Returns true if the interval is a diminished octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if diminished octave.

◆ isDiminishedSeventh()

bool Interval::isDiminishedSeventh ( const bool  useEnharmony = false) const

Returns true if the interval is a diminished seventh.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if diminished seventh.

◆ isDiminishedUnisson()

bool Interval::isDiminishedUnisson ( const bool  useEnharmony = false) const

Returns true if the interval is a diminished unison.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if diminished unison.

◆ isEleventh()

bool Interval::isEleventh ( const bool  useEnharmony = false) const

Returns true if the interval is an eleventh (perfect or sharp).

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if eleventh.

◆ isFifth()

bool Interval::isFifth ( const bool  useEnharmony = false) const

Returns true if the interval is a generic fifth (perfect, augmented, or diminished).

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if fifth.

◆ isFourth()

bool Interval::isFourth ( const bool  useEnharmony = false) const

Returns true if the interval is a generic fourth (perfect, augmented, or diminished).

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if fourth.

◆ isMajor()

bool Interval::isMajor ( const bool  useEnharmony = false) const

Returns true if the interval is major.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if major.

◆ isMajorNinth()

bool Interval::isMajorNinth ( const bool  useEnharmony = false) const

Returns true if the interval is a major ninth.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if major ninth.

◆ isMajorSecond()

bool Interval::isMajorSecond ( const bool  useEnharmony = false) const

Returns true if the interval is a major second.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if major second.

◆ isMajorSeventh()

bool Interval::isMajorSeventh ( const bool  useEnharmony = false) const

Returns true if the interval is a major seventh.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if major seventh.

◆ isMajorSixth()

bool Interval::isMajorSixth ( const bool  useEnharmony = false) const

Returns true if the interval is a major sixth.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if major sixth.

◆ isMajorThird()

bool Interval::isMajorThird ( const bool  useEnharmony = false) const

Returns true if the interval is a major third.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if major third.

◆ isMajorThirdteenth()

bool Interval::isMajorThirdteenth ( const bool  useEnharmony = false) const

Returns true if the interval is a major thirteenth.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if major thirteenth.

◆ isMinor()

bool Interval::isMinor ( const bool  useEnharmony = false) const

Returns true if the interval is minor.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if minor.

◆ isMinorNinth()

bool Interval::isMinorNinth ( const bool  useEnharmony = false) const

Returns true if the interval is a minor ninth.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if minor ninth.

◆ isMinorSecond()

bool Interval::isMinorSecond ( const bool  useEnharmony = false) const

Returns true if the interval is a minor second.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if minor second.

◆ isMinorSeventh()

bool Interval::isMinorSeventh ( const bool  useEnharmony = false) const

Returns true if the interval is a minor seventh.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if minor seventh.

◆ isMinorSixth()

bool Interval::isMinorSixth ( const bool  useEnharmony = false) const

Returns true if the interval is a minor sixth.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if minor sixth.

◆ isMinorThird()

bool Interval::isMinorThird ( const bool  useEnharmony = false) const

Returns true if the interval is a minor third.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if minor third.

◆ isMinorThirdteenth()

bool Interval::isMinorThirdteenth ( const bool  useEnharmony = false) const

Returns true if the interval is a minor thirteenth.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if minor thirteenth.

◆ isNinth()

bool Interval::isNinth ( const bool  useEnharmony = false) const

Returns true if the interval is a ninth (major or minor).

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if ninth.

◆ isOctave()

bool Interval::isOctave ( const bool  useEnharmony = false) const

Returns true if the interval is an octave (perfect, augmented, or diminished).

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if octave.

◆ isPerfect()

bool Interval::isPerfect ( const bool  useEnharmony = false) const

Returns true if the interval is perfect.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if perfect.

◆ isPerfectEleventh()

bool Interval::isPerfectEleventh ( const bool  useEnharmony = false) const

Returns true if the interval is a perfect eleventh.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if perfect eleventh.

◆ isPerfectFifth()

bool Interval::isPerfectFifth ( const bool  useEnharmony = false) const

Returns true if the interval is a perfect fifth.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if perfect fifth.

◆ isPerfectFourth()

bool Interval::isPerfectFourth ( const bool  useEnharmony = false) const

Returns true if the interval is a perfect fourth.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if perfect fourth.

◆ isPerfectOctave()

bool Interval::isPerfectOctave ( const bool  useEnharmony = false) const

Returns true if the interval is a perfect octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if perfect octave.

◆ isPerfectUnisson()

bool Interval::isPerfectUnisson ( const bool  useEnharmony = false) const

Returns true if the interval is a perfect unison.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if perfect unison.

◆ isSecond()

bool Interval::isSecond ( const bool  useEnharmony = false) const

Returns true if the interval is a generic second (major or minor).

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if second.

◆ isSeventh()

bool Interval::isSeventh ( const bool  useEnharmony = false) const

Returns true if the interval is a generic seventh (major, minor, or diminished).

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if seventh.

◆ isSharpEleventh()

bool Interval::isSharpEleventh ( const bool  useEnharmony = false) const

Returns true if the interval is a sharp eleventh.

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if sharp eleventh.

◆ isSimple()

bool Interval::isSimple ( ) const

Returns true if the interval is simple (within an octave).

Returns
True if simple.

◆ isSixth()

bool Interval::isSixth ( const bool  useEnharmony = false) const

Returns true if the interval is a generic sixth (major or minor).

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if sixth.

◆ isThird()

bool Interval::isThird ( const bool  useEnharmony = false) const

Returns true if the interval is a generic third (major or minor).

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if third.

◆ isThirdteenth()

bool Interval::isThirdteenth ( const bool  useEnharmony = false) const

Returns true if the interval is a thirteenth (major or minor).

Parameters
useEnharmonyIf true, considers enharmonic equivalence.
Returns
True if thirteenth.

◆ isTonal()

bool Interval::isTonal ( ) const

Returns true if the interval is tonal (major, minor, perfect, etc.).

Returns
True if tonal.

◆ operator<()

bool Interval::operator< ( const Interval otherInterval) const
inline

Less-than operator for comparing intervals by number of semitones.

Parameters
otherIntervalInterval to compare.
Returns
True if this interval is smaller.

◆ setNotes() [1/2]

void Interval::setNotes ( const Note note_A,
const Note note_B 
)

Sets the notes of the interval using Note objects.

Parameters
note_AFirst Note.
note_BSecond Note.

◆ setNotes() [2/2]

void Interval::setNotes ( const std::string &  pitch_A,
const std::string &  pitch_B 
)

Sets the notes of the interval using pitch strings.

Parameters
pitch_AFirst pitch string.
pitch_BSecond pitch string.

◆ toCents()

int Interval::toCents ( const float  freqA4 = 440.0f) const

Returns the interval size in cents (for microtonal/tuning analysis).

Parameters
freqA4Reference frequency for A4 (default: 440.0 Hz).
Returns
Interval size in cents.

The documentation for this class was generated from the following file: