maiacore 1.10.1
Music analisys library
Chord Class Reference

Represents a musical chord. More...

#include <chord.h>

Public Member Functions

 Chord ()
 Construct an empty Chord object. More...
 
 Chord (const std::vector< Note > &notes, const RhythmFigure rhythmFigure=RhythmFigure::QUARTER)
 Construct a Chord from a vector of Note objects. More...
 
 Chord (const std::vector< std::string > &pitches, const RhythmFigure rhythmFigure=RhythmFigure::QUARTER)
 Construct a Chord from a vector of pitch strings. More...
 
 ~Chord ()
 Destroy the Chord object and release resources.
 
void clear ()
 Remove all notes from the chord, resetting its state.
 
void addNote (const Note &note)
 Add a Note object to the chord. More...
 
void addNote (const std::string &pitch)
 Add a note to the chord by pitch string. More...
 
void removeTopNote ()
 Remove the top (last) note from the chord.
 
void insertNote (Note &insertNote, int positionNote=0)
 Insert a note at a specific position in the chord. More...
 
void removeNote (int noteIndex)
 Remove a note at a specific index from the chord. More...
 
void setDuration (const Duration &duration)
 Set the duration for all notes in the chord. More...
 
void setDuration (const float quarterDuration, const int divisionsPerQuarterNote=256)
 Set the duration for all notes in the chord using quarter note value. More...
 
void toInversion (int inversionNumber)
 Invert the chord by moving the lowest note up by one octave, repeated inversionNumber times. More...
 
void transpose (const int semiTonesNumber)
 Transpose all notes in the chord by a number of semitones. More...
 
void transposeStackOnly (const int semiTonesNumber)
 Transpose only the stacked (open) version of the chord by a number of semitones. More...
 
void removeDuplicateNotes ()
 Remove duplicate notes (by pitch) from the chord.
 
std::vector< HeapData > getStackedHeaps (const bool enharmonyNotes=false)
 Get all possible stacked heaps (enharmonic variants) for the chord. More...
 
std::string getDuration () const
 Get the shortest duration type among all notes in the chord. More...
 
float getQuarterDuration () const
 Get the shortest duration in quarter notes among all notes. More...
 
int getDurationTicks () const
 Get the minimum duration in ticks among all notes. More...
 
NotegetNote (int noteIndex)
 Get a reference to a note at a given index. More...
 
const NotegetNote (const int noteIndex) const
 Get a const reference to a note at a given index. More...
 
const NotegetRoot ()
 Get the root note of the chord (after stacking in thirds). More...
 
std::string getName ()
 Get the chord name using tonal analysis (e.g., "Cm7", "G7"). More...
 
const NotegetBassNote ()
 Get the bass note of the chord (lowest note). More...
 
const std::vector< Note > & getNotes () const
 Get all notes in the chord (original order). More...
 
float getCloseStackHarmonicComplexity (const bool useEnharmony=false)
 Compute the harmonic complexity of the chord in closed position. More...
 
float getHarmonicDensity (int lowerBoundMIDI=-1, int higherBoundMIDI=-1) const
 Compute the harmonic density of the chord in a MIDI range. More...
 
float getHarmonicDensity (const std::string &lowerBoundPitch={}, const std::string &higherBoundPitch={}) const
 Compute the harmonic density of the chord in a pitch range. More...
 
bool haveMajorInterval (const bool useEnharmony=false) const
 Check if the chord contains at least one major interval. More...
 
bool haveMinorInterval (const bool useEnharmony=false) const
 Check if the chord contains at least one minor interval. More...
 
bool havePerfectInterval (const bool useEnharmony=false) const
 Check if the chord contains at least one perfect interval. More...
 
bool haveDiminishedInterval (const bool useEnharmony=false) const
 Check if the chord contains at least one diminished interval. More...
 
bool haveAugmentedInterval (const bool useEnharmony=false) const
 Check if the chord contains at least one augmented interval. More...
 
bool haveDiminishedUnisson (const bool useEnharmony=false) const
 Checks if the chord contains a diminished unison interval (e.g., C and Cb). More...
 
bool havePerfectUnisson (const bool useEnharmony=false) const
 Checks if the chord contains a perfect unison interval (e.g., two notes with the same pitch). More...
 
bool haveAugmentedUnisson (const bool useEnharmony=false) const
 Checks if the chord contains an augmented unison interval (e.g., C and C#). More...
 
bool haveMinorSecond (const bool useEnharmony=false)
 Checks if the chord contains a minor second interval (e.g., C and Db). More...
 
bool haveMajorSecond (const bool useEnharmony=false)
 Checks if the chord contains a major second interval (e.g., C and D). More...
 
bool haveMinorThird (const bool useEnharmony=false)
 Checks if the chord contains a minor third interval (e.g., C and Eb). More...
 
bool haveMajorThird (const bool useEnharmony=false)
 Checks if the chord contains a major third interval (e.g., C and E). More...
 
bool havePerfectFourth (const bool useEnharmony=false)
 Checks if the chord contains a perfect fourth interval (e.g., C and F). More...
 
bool haveAugmentedFourth (const bool useEnharmony=false)
 Checks if the chord contains an augmented fourth interval (tritone, e.g., C and F#). More...
 
bool haveDiminishedFifth (const bool useEnharmony=false)
 Checks if the chord contains a diminished fifth interval (tritone, e.g., C and Gb). More...
 
bool havePerfectFifth (const bool useEnharmony=false)
 Checks if the chord contains a perfect fifth interval (e.g., C and G). More...
 
bool haveAugmentedFifth (const bool useEnharmony=false)
 Checks if the chord contains an augmented fifth interval (e.g., C and G#). More...
 
bool haveMinorSixth (const bool useEnharmony=false)
 Checks if the chord contains a minor sixth interval (e.g., C and Ab). More...
 
bool haveMajorSixth (const bool useEnharmony=false)
 Checks if the chord contains a major sixth interval (e.g., C and A). More...
 
bool haveDiminishedSeventh (const bool useEnharmony=false)
 Checks if the chord contains a diminished seventh interval (e.g., C and Bbb). More...
 
bool haveMinorSeventh (const bool useEnharmony=false)
 Checks if the chord contains a minor seventh interval (e.g., C and Bb). More...
 
bool haveMajorSeventh (const bool useEnharmony=false)
 Checks if the chord contains a major seventh interval (e.g., C and B). More...
 
bool haveDiminishedOctave (const bool useEnharmony=false)
 Checks if the chord contains a diminished octave interval (e.g., C and Cb an octave apart). More...
 
bool havePerfectOctave (const bool useEnharmony=false)
 Checks if the chord contains a perfect octave interval (e.g., C4 and C5). More...
 
bool haveAugmentedOctave (const bool useEnharmony=false)
 Checks if the chord contains an augmented octave interval (e.g., C and C# an octave apart). More...
 
bool haveMinorNinth (const bool useEnharmony=false)
 Checks if the chord contains a minor ninth interval (e.g., C and Db an octave apart). More...
 
bool haveMajorNinth (const bool useEnharmony=false)
 Checks if the chord contains a major ninth interval (e.g., C and D an octave apart). More...
 
bool havePerfectEleventh (const bool useEnharmony=false)
 Checks if the chord contains a perfect eleventh interval (e.g., C and F two octaves apart). More...
 
bool haveSharpEleventh (const bool useEnharmony=false)
 Checks if the chord contains a sharp eleventh interval (e.g., C and F# two octaves apart). More...
 
bool haveMinorThirdteenth (const bool useEnharmony=false)
 Checks if the chord contains a minor thirteenth interval (e.g., C and Ab two octaves plus a sixth apart). More...
 
bool haveMajorThirdteenth (const bool useEnharmony=false)
 Checks if the chord contains a major thirteenth interval (e.g., C and A two octaves plus a sixth apart). More...
 
bool haveSecond (const bool useEnharmony=false) const
 Checks if the chord contains any second interval (major or minor) between its notes. More...
 
bool haveThird (const bool useEnharmony=false) const
 Checks if the chord contains any third interval (major or minor) between its notes. More...
 
bool haveFourth (const bool useEnharmony=false) const
 Checks if the chord contains any fourth interval (perfect, augmented, or diminished) between its notes. More...
 
bool haveFifth (const bool useEnharmony=false) const
 Checks if the chord contains any fifth interval (perfect, augmented, or diminished) between its notes. More...
 
bool haveSixth (const bool useEnharmony=false) const
 Checks if the chord contains any sixth interval (major or minor) between its notes. More...
 
bool haveSeventh (const bool useEnharmony=false) const
 Checks if the chord contains any seventh interval (major, minor, or diminished) between its notes. More...
 
bool haveOctave (const bool useEnharmony=false) const
 Checks if the chord contains any octave interval (perfect, augmented, or diminished) between its notes. More...
 
bool haveNinth (const bool useEnharmony=false) const
 Checks if the chord contains any ninth interval (major or minor) between its notes. More...
 
bool haveEleventh (const bool useEnharmony=false) const
 Checks if the chord contains any eleventh interval (perfect or sharp) between its notes. More...
 
bool haveThirdteenth (const bool useEnharmony=false) const
 Checks if the chord contains any thirteenth interval (major or minor) between its notes. More...
 
bool haveAnyOctaveMinorSecond (const bool useEnharmony=false) const
 Checks if the chord contains a minor second interval between any two notes, ignoring octave differences. More...
 
bool haveAnyOctaveMajorSecond (const bool useEnharmony=false) const
 Checks if the chord contains a major second interval between any two notes, ignoring octave differences. More...
 
bool haveAnyOctaveMinorThird (const bool useEnharmony=false) const
 Checks if the chord contains a minor third interval between any two notes, ignoring octave differences. More...
 
bool haveAnyOctaveMajorThird (const bool useEnharmony=false) const
 Checks if the chord contains a major third interval between any two notes, ignoring octave differences. More...
 
bool haveAnyOctavePerfectFourth (const bool useEnharmony=false) const
 Checks if the chord contains a perfect fourth interval between any two notes, ignoring octave differences. More...
 
bool haveAnyOctaveAugmentedFourth (const bool useEnharmony=false) const
 Checks if the chord contains an augmented fourth interval between any two notes, ignoring octave differences. More...
 
bool haveAnyOctaveDiminishedFifth (const bool useEnharmony=false) const
 Checks if the chord contains a diminished fifth interval between any two notes, ignoring octave differences. More...
 
bool haveAnyOctavePerfectFifth (const bool useEnharmony=false) const
 Checks if the chord contains a perfect fifth interval between any two notes, ignoring octave differences. More...
 
bool haveAnyOctaveAugmentedFifth (const bool useEnharmony=false) const
 Checks if the chord contains an augmented fifth interval between any two notes, ignoring octave differences. More...
 
bool haveAnyOctaveMinorSixth (const bool useEnharmony=false) const
 Checks if the chord contains a minor sixth interval between any two notes, ignoring octave differences. More...
 
bool haveAnyOctaveMajorSixth (const bool useEnharmony=false) const
 Checks if the chord contains a major sixth interval between any two notes, ignoring octave differences. More...
 
bool haveAnyOctaveDiminishedSeventh (const bool useEnharmony=false) const
 Checks if the chord contains a diminished seventh interval between any two notes, ignoring octave differences. More...
 
bool haveAnyOctaveMinorSeventh (const bool useEnharmony=false) const
 Checks if the chord contains a minor seventh interval between any two notes, ignoring octave differences. More...
 
bool haveAnyOctaveMajorSeventh (const bool useEnharmony=false) const
 Checks if the chord contains a major seventh interval between any two notes, ignoring octave differences. More...
 
bool haveAnyOctaveDiminishedOctave (const bool useEnharmony=false) const
 Checks if the chord contains a diminished octave interval between any two notes, ignoring octave differences. More...
 
bool haveAnyOctavePerfectOctave (const bool useEnharmony=false) const
 Checks if the chord contains a perfect octave interval between any two notes, ignoring octave differences. More...
 
bool haveAnyOctaveAugmentedOctave (const bool useEnharmony=false) const
 Checks if the chord contains an augmented octave interval between any two notes, ignoring octave differences. More...
 
bool haveAnyOctaveSecond () const
 Checks if the chord contains a generic second interval (major or minor, any octave). More...
 
bool haveAnyOctaveThird () const
 Checks if the chord contains a generic third interval (major or minor, any octave). More...
 
bool haveAnyOctaveFourth () const
 Checks if the chord contains a generic fourth interval (perfect, augmented, or diminished, any octave). More...
 
bool haveAnyOctaveFifth () const
 Checks if the chord contains a generic fifth interval (perfect, augmented, or diminished, any octave). More...
 
bool haveAnyOctaveSixth () const
 Checks if the chord contains a generic sixth interval (major or minor, any octave). More...
 
bool haveAnyOctaveSeventh () const
 Checks if the chord contains a generic seventh interval (major, minor, or diminished, any octave). More...
 
bool haveAnyOctaveOctave () const
 Checks if the chord contains a generic octave interval (perfect, augmented, or diminished, any octave). More...
 
bool isDyad ()
 Determines if the chord is a dyad (contains exactly two distinct notes). More...
 
bool isSus ()
 Determines if the chord is a suspended chord (sus2 or sus4). More...
 
bool isMajorChord ()
 Determines if the chord is a major triad. More...
 
bool isMinorChord ()
 Determines if the chord is a minor triad. More...
 
bool isAugmentedChord ()
 Determines if the chord is an augmented triad. More...
 
bool isDiminishedChord ()
 Determines if the chord is a diminished triad. More...
 
bool isHalfDiminishedChord ()
 Determines if the chord is a half-diminished seventh chord. More...
 
bool isWholeDiminishedChord ()
 Determines if the chord is a fully diminished seventh chord. More...
 
bool isDominantSeventhChord ()
 Determines if the chord is a dominant seventh chord. More...
 
std::string getQuality ()
 Returns a string describing the chord quality (e.g., "major", "minor", "diminished", "augmented", "sus", etc). More...
 
bool isSorted () const
 Checks if the notes in the chord are sorted in ascending order by MIDI number. More...
 
bool isTonal (std::function< bool(const Chord &chord)> model=nullptr)
 Determines if the chord is tonal according to a given model or default rules. More...
 
bool isInRootPosition ()
 Checks if the chord is in root position (lowest note is the root). More...
 
std::vector< int > getMidiIntervals (const bool firstNoteAsReference=false) const
 Returns the intervals between notes in the chord as MIDI semitone values. More...
 
std::vector< IntervalgetIntervals (const bool firstNoteAsReference=false) const
 Returns the intervals between notes in the chord as Interval objects. More...
 
std::vector< IntervalgetIntervalsFromOriginalSortedNotes () const
 Returns the intervals between the sorted original notes as Interval objects. More...
 
std::vector< IntervalgetOpenStackIntervals (const bool firstNoteAsReference=false)
 Returns the intervals between notes in the open stack as Interval objects. More...
 
std::vector< IntervalgetCloseStackIntervals (const bool firstNoteAsReference=false)
 Returns the intervals between notes in the closed stack as Interval objects. More...
 
std::vector< NotegetOpenStackNotes ()
 Returns the notes of the chord in open stack (stacked in thirds) order. More...
 
int size () const
 Returns the number of notes in the chord. More...
 
int stackSize ()
 Returns the number of notes in the open stack (after stacking in thirds). More...
 
void print () const
 Prints the pitches of all notes in the chord to the log. More...
 
void printStack () const
 Prints the pitches of all notes in the open stack to the log. More...
 
void info ()
 Prints detailed information about the chord, including name, size, notes, and stack. More...
 
Chord getOpenStackChord (const bool enharmonyNotes=false)
 Returns a Chord object representing the open stack (stacked in thirds). More...
 
Chord getCloseStackChord (const bool enharmonyNotes=false)
 Returns a Chord object representing the closed stack (stacked in thirds, closed position). More...
 
Chord getCloseChord (const bool enharmonyNotes=false)
 Returns a Chord object representing the closed chord, with octaves adjusted to match the original. More...
 
void sortNotes ()
 Sorts the notes in the chord in ascending order by MIDI number. More...
 
std::vector< int > toCents () const
 Returns a vector with the intervals (in cents) between each pair of adjacent notes in the chord. More...
 
int getDegree (const Key &key, bool enharmonyNotes=false)
 Returns the scale degree of the chord's root in a given key. More...
 
std::string getRomanDegree (const Key &key, bool enharmonyNotes=false)
 Returns the Roman numeral degree of the chord's root in a given key. More...
 
float getMeanFrequency (const float freqA4=440.0f) const
 Calculates the arithmetic mean of the frequencies of all notes in the chord. More...
 
float getMeanOfExtremesFrequency (const float freqA4=440.0f) const
 Calculates the mean frequency between the lowest and highest notes in the chord. More...
 
float getFrequencyStd (const float freqA4=440.0f) const
 Calculates the standard deviation of the frequencies of all notes in the chord. More...
 
int getMeanMidiValue () const
 Calculates the arithmetic mean of the MIDI numbers of all notes in the chord. More...
 
int getMeanOfExtremesMidiValue () const
 Calculates the mean MIDI value between the lowest and highest notes in the chord. More...
 
float getMidiValueStd () const
 Calculates the standard deviation of the MIDI numbers of all notes in the chord. More...
 
std::string getMeanPitch (const std::string &accType={}) const
 Returns the pitch name corresponding to the mean MIDI value of the chord. More...
 
std::string getMeanOfExtremesPitch (const std::string &accType={}) const
 Returns the pitch name corresponding to the mean of the lowest and highest MIDI values in the chord. More...
 
std::pair< std::vector< float >, std::vector< float > > getHarmonicSpectrum (const int numPartialsPerNote=6, const std::function< std::vector< float >(std::vector< float >)> amplCallback=nullptr, const float partialsDecayExpRate=0.88f) const
 Computes the combined harmonic spectrum of the chord by summing the spectra of all notes. More...
 
SetharesDissonanceTable getSetharesDyadsDissonanceValue (const int numPartials=6, const bool useMinModel=true, const std::function< std::vector< float >(std::vector< float >)> amplCallback=nullptr, const float partialsDecayExpRate=0.88f) const
 Calculates the Sethares dissonance value for all dyads in the chord. More...
 
float getSetharesDissonance (const int numPartialsPerNote=6, const bool useMinModel=true, const std::function< std::vector< float >(std::vector< float >)> amplCallback=nullptr, const float partialsDecayExpRate=0.88f, const std::function< float(std::vector< float >)> dissCallback=nullptr) const
 Calculates the total Sethares dissonance for the chord. More...
 
const Noteoperator[] (size_t index) const
 Array subscript operator for read-only access to notes in original (unsorted) order. More...
 
Noteoperator[] (size_t index)
 Array subscript operator for mutable access to notes in original (unsorted) order. More...
 
bool operator== (const Chord &otherChord) const
 Equality operator comparing chords by pitch-space note ordering. More...
 
bool operator!= (const Chord &otherChord) const
 Inequality operator comparing chords by pitch-space note ordering. More...
 
Chord operator+ (const Chord &otherChord) const
 
std::vector< Note >::iterator begin ()
 Returns an iterator to the beginning of the original notes vector. More...
 
std::vector< Note >::iterator end ()
 Returns an iterator to the end of the original notes vector. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const Chord &chord)
 Output stream operator for Chord. Prints the chord as a list of pitches. More...
 

Detailed Description

Represents a musical chord.

The Chord class encapsulates a collection of musical notes, allowing for operations such as stacking in thirds, transposing, and computing harmonic properties. It supports both open and closed stack representations, as well as enharmonic transformations of notes.

Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

Constructor & Destructor Documentation

◆ Chord() [1/3]

Chord::Chord ( )

Construct an empty Chord object.

The chord will have no notes initially.

Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ Chord() [2/3]

Chord::Chord ( const std::vector< Note > &  notes,
const RhythmFigure  rhythmFigure = RhythmFigure::QUARTER 
)
explicit

Construct a Chord from a vector of Note objects.

Parameters
notesVector of Note objects to initialize the chord.
rhythmFigureThe rhythm figure to assign to each note (default: QUARTER).

◆ Chord() [3/3]

Chord::Chord ( const std::vector< std::string > &  pitches,
const RhythmFigure  rhythmFigure = RhythmFigure::QUARTER 
)
explicit

Construct a Chord from a vector of pitch strings.

Parameters
pitchesVector of pitch strings (e.g., "C4", "E4", "G4").
rhythmFigureThe rhythm figure to assign to each note (default: QUARTER).

Member Function Documentation

◆ addNote() [1/2]

void Chord::addNote ( const Note note)

Add a Note object to the chord.

Parameters
noteThe Note to add. Rests are ignored.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ addNote() [2/2]

void Chord::addNote ( const std::string &  pitch)

Add a note to the chord by pitch string.

Parameters
pitchThe pitch string (e.g., "C4").

◆ begin()

std::vector< Note >::iterator Chord::begin ( )
inline

Returns an iterator to the beginning of the original notes vector.

Returns
Iterator to the first Note in the chord.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ end()

std::vector< Note >::iterator Chord::end ( )
inline

Returns an iterator to the end of the original notes vector.

Returns
Iterator to one past the last Note in the chord.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getBassNote()

const Note & Chord::getBassNote ( )

Get the bass note of the chord (lowest note).

Returns
Const reference to the bass Note.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getCloseChord()

Chord Chord::getCloseChord ( const bool  enharmonyNotes = false)

Returns a Chord object representing the closed chord, with octaves adjusted to match the original.

Optionally considers enharmonic equivalents for stacking.

Parameters
enharmonyNotesIf true, considers enharmonic equivalents.
Returns
Chord object in closed form with original octaves.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getCloseStackChord()

Chord Chord::getCloseStackChord ( const bool  enharmonyNotes = false)

Returns a Chord object representing the closed stack (stacked in thirds, closed position).

Optionally considers enharmonic equivalents for stacking.

Parameters
enharmonyNotesIf true, considers enharmonic equivalents.
Returns
Chord object in closed stack form.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getCloseStackHarmonicComplexity()

float Chord::getCloseStackHarmonicComplexity ( const bool  useEnharmony = false)

Compute the harmonic complexity of the chord in closed position.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
Normalized complexity value (0.0 to 1.0).

Calculates harmonic complexity by analyzing the intervallic structure of the chord in its closed-stack (root position) configuration. The complexity metric quantifies the degree of dissonance and intervallic tension based on:

  • Interval quality distribution (consonant vs. dissonant intervals)
  • Number of distinct interval classes present
  • Presence of augmented/diminished intervals (chromaticism indicator)

Returns a normalized value where:

  • 0.0 represents minimal complexity (e.g., perfect unisons, octaves, simple triads)
  • 1.0 represents maximal complexity (highly chromatic cluster chords, tone clusters)

When useEnharmony=true, enharmonic equivalents (e.g., C# ≡ Db) are treated as identical pitch classes, reducing perceived complexity in chromatic contexts.

This metric is useful for:

  • Quantifying harmonic tension in tonal and post-tonal music
  • Analyzing chord progressions for complexity contours
  • Identifying moments of harmonic density in scores
  • Comparative analysis of tertian vs. quartal/quintal harmony
Note
The closed-stack representation ensures transposition and inversion invariance for complexity calculations, enabling direct comparison across different voicings.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getCloseStackIntervals()

std::vector< Interval > Chord::getCloseStackIntervals ( const bool  firstNoteAsReference = false)

Returns the intervals between notes in the closed stack as Interval objects.

If firstNoteAsReference is true, intervals are calculated from the first note to each subsequent note. Otherwise, intervals are calculated between each pair of adjacent notes.

Parameters
firstNoteAsReferenceIf true, use the first note as the reference for all intervals.
Returns
Vector of Interval objects.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getDegree()

int Chord::getDegree ( const Key key,
bool  enharmonyNotes = false 
)

Returns the scale degree of the chord's root in a given key.

The degree is calculated relative to the provided Key object, considering enharmonic spelling if requested.

Parameters
keyThe Key object representing the tonal center.
enharmonyNotesIf true, considers enharmonic equivalents for the root.
Returns
Integer representing the scale degree (1 = tonic, 2 = supertonic, etc).
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getDuration()

std::string Chord::getDuration ( ) const

Get the shortest duration type among all notes in the chord.

Returns
String representing the duration type (e.g., "quarter").
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getDurationTicks()

int Chord::getDurationTicks ( ) const

Get the minimum duration in ticks among all notes.

Returns
Duration in ticks as int.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getFrequencyStd()

float Chord::getFrequencyStd ( const float  freqA4 = 440.0f) const

Calculates the standard deviation of the frequencies of all notes in the chord.

Useful for measuring the spectral spread or compactness of the chord.

Parameters
freqA4Reference frequency for A4 (default: 440.0 Hz).
Returns
Frequency standard deviation as a float.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getHarmonicDensity() [1/2]

float Chord::getHarmonicDensity ( const std::string &  lowerBoundPitch = {},
const std::string &  higherBoundPitch = {} 
) const

Compute the harmonic density of the chord in a pitch range.

Parameters
lowerBoundPitchLowest pitch string (e.g., "C4").
higherBoundPitchHighest pitch string (e.g., "G5").
Returns
Density as float.

◆ getHarmonicDensity() [2/2]

float Chord::getHarmonicDensity ( int  lowerBoundMIDI = -1,
int  higherBoundMIDI = -1 
) const

Compute the harmonic density of the chord in a MIDI range.

Parameters
lowerBoundMIDILowest MIDI note (default: -1, auto-detect).
higherBoundMIDIHighest MIDI note (default: -1, auto-detect).
Returns
Density as float.

Calculates the spatial distribution of notes within a specified MIDI pitch range, quantifying how densely packed the harmonic content is across the frequency spectrum. The density metric reflects:

  • Average interval spacing between adjacent notes in ascending pitch order
  • Registral compression (cluster chords) vs. expansion (open voicings)
  • Spectral distribution of harmonic energy

When bounds are set to -1 (default), the function automatically detects the range using the chord's lowest and highest notes. Custom bounds enable:

  • Fixed-range density comparison across different chords
  • Orchestral register analysis (e.g., bass register density C1-C3)
  • Texture analysis within specific frequency bands

Higher density values indicate:

  • Close-voiced harmonies, tone clusters, chromatic saturation
  • Potential for increased psychoacoustic roughness (critical band interactions)

Lower density values indicate:

  • Open voicings, wide spacing, arpeggiated textures
  • Greater spectral clarity and reduced masking effects

Useful for analyzing orchestration, voice-leading efficiency, and harmonic texture.

Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getHarmonicSpectrum()

std::pair< std::vector< float >, std::vector< float > > Chord::getHarmonicSpectrum ( const int  numPartialsPerNote = 6,
const std::function< std::vector< float >(std::vector< float >)>  amplCallback = nullptr,
const float  partialsDecayExpRate = 0.88f 
) const

Computes the combined harmonic spectrum of the chord by summing the spectra of all notes.

Useful for timbral and psychoacoustic analysis.

Parameters
numPartialsPerNoteNumber of partials to include for each note.
amplCallbackOptional: function to modify amplitude vector.
partialsDecayExpRateOptional Partials decay exponential rate (default: 0.88).
Returns
Pair of vectors: frequencies and corresponding amplitudes.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getIntervals()

std::vector< Interval > Chord::getIntervals ( const bool  firstNoteAsReference = false) const

Returns the intervals between notes in the chord as Interval objects.

If firstNoteAsReference is true, intervals are calculated from the first note to each subsequent note. Otherwise, intervals are calculated between each pair of adjacent notes.

Parameters
firstNoteAsReferenceIf true, use the first note as the reference for all intervals.
Returns
Vector of Interval objects.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getIntervalsFromOriginalSortedNotes()

std::vector< Interval > Chord::getIntervalsFromOriginalSortedNotes ( ) const

Returns the intervals between the sorted original notes as Interval objects.

Useful for intervallic analysis independent of note order.

Returns
Vector of Interval objects between sorted notes.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getMeanFrequency()

float Chord::getMeanFrequency ( const float  freqA4 = 440.0f) const

Calculates the arithmetic mean of the frequencies of all notes in the chord.

Useful for spectral centroid and timbral analysis.

Parameters
freqA4Reference frequency for A4 (default: 440.0 Hz).
Returns
Mean frequency as a float.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getMeanMidiValue()

int Chord::getMeanMidiValue ( ) const

Calculates the arithmetic mean of the MIDI numbers of all notes in the chord.

Useful for pitch center analysis.

Returns
Mean MIDI value as an integer.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getMeanOfExtremesFrequency()

float Chord::getMeanOfExtremesFrequency ( const float  freqA4 = 440.0f) const

Calculates the mean frequency between the lowest and highest notes in the chord.

Useful for summarizing the chord's spectral span.

Parameters
freqA4Reference frequency for A4 (default: 440.0 Hz).
Returns
Mean of extremes frequency as a float.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getMeanOfExtremesMidiValue()

int Chord::getMeanOfExtremesMidiValue ( ) const

Calculates the mean MIDI value between the lowest and highest notes in the chord.

Useful for summarizing the pitch range of the chord.

Returns
Mean of extremes MIDI value as an integer.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getMeanOfExtremesPitch()

std::string Chord::getMeanOfExtremesPitch ( const std::string &  accType = {}) const

Returns the pitch name corresponding to the mean of the lowest and highest MIDI values in the chord.

The accidental type can be specified (e.g., sharp, flat, natural).

Parameters
accTypeOptional: specify accidental type for pitch spelling.
Returns
String with the pitch name (e.g., "C4", "F#3").
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getMeanPitch()

std::string Chord::getMeanPitch ( const std::string &  accType = {}) const

Returns the pitch name corresponding to the mean MIDI value of the chord.

The accidental type can be specified (e.g., sharp, flat, natural).

Parameters
accTypeOptional: specify accidental type for pitch spelling.
Returns
String with the pitch name (e.g., "C4", "F#3").
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getMidiIntervals()

std::vector< int > Chord::getMidiIntervals ( const bool  firstNoteAsReference = false) const

Returns the intervals between notes in the chord as MIDI semitone values.

If firstNoteAsReference is true, intervals are calculated from the first note to each subsequent note. Otherwise, intervals are calculated between each pair of adjacent notes.

Parameters
firstNoteAsReferenceIf true, use the first note as the reference for all intervals.
Returns
Vector of intervals in semitones.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getMidiValueStd()

float Chord::getMidiValueStd ( ) const

Calculates the standard deviation of the MIDI numbers of all notes in the chord.

Useful for measuring the pitch spread or compactness of the chord.

Returns
MIDI value standard deviation as a float.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getName()

std::string Chord::getName ( )

Get the chord name using tonal analysis (e.g., "Cm7", "G7").

Returns
String with the chord name, or empty if indeterminate.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getNote() [1/2]

const Note & Chord::getNote ( const int  noteIndex) const

Get a const reference to a note at a given index.

Parameters
noteIndexIndex of the note.
Returns
Const reference to the Note.

◆ getNote() [2/2]

Note & Chord::getNote ( int  noteIndex)

Get a reference to a note at a given index.

Parameters
noteIndexIndex of the note.
Returns
Reference to the Note.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getNotes()

const std::vector< Note > & Chord::getNotes ( ) const

Get all notes in the chord (original order).

Returns
Const reference to vector of Notes.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getOpenStackChord()

Chord Chord::getOpenStackChord ( const bool  enharmonyNotes = false)

Returns a Chord object representing the open stack (stacked in thirds).

Optionally considers enharmonic equivalents for stacking.

Parameters
enharmonyNotesIf true, considers enharmonic equivalents.
Returns
Chord object in open stack form.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getOpenStackIntervals()

std::vector< Interval > Chord::getOpenStackIntervals ( const bool  firstNoteAsReference = false)

Returns the intervals between notes in the open stack as Interval objects.

If firstNoteAsReference is true, intervals are calculated from the first note to each subsequent note. Otherwise, intervals are calculated between each pair of adjacent notes.

Parameters
firstNoteAsReferenceIf true, use the first note as the reference for all intervals.
Returns
Vector of Interval objects.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getOpenStackNotes()

std::vector< Note > Chord::getOpenStackNotes ( )

Returns the notes of the chord in open stack (stacked in thirds) order.

Triggers stacking if not already performed.

Returns
Vector of Note objects in open stack order.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getQuality()

std::string Chord::getQuality ( )

Returns a string describing the chord quality (e.g., "major", "minor", "diminished", "augmented", "sus", etc).

The quality is determined by the chord's interval structure and is useful for harmonic analysis.

Returns
String representing the chord quality.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getQuarterDuration()

float Chord::getQuarterDuration ( ) const

Get the shortest duration in quarter notes among all notes.

Returns
Duration in quarter notes as float.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getRomanDegree()

std::string Chord::getRomanDegree ( const Key key,
bool  enharmonyNotes = false 
)

Returns the Roman numeral degree of the chord's root in a given key.

The degree is calculated relative to the provided Key object, considering enharmonic spelling if requested.

Parameters
keyThe Key object representing the tonal center.
enharmonyNotesIf true, considers enharmonic equivalents for the root.
Returns
String with the Roman numeral (e.g., "I", "ii", "V").
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getRoot()

const Note & Chord::getRoot ( )

Get the root note of the chord (after stacking in thirds).

Returns
Const reference to the root Note.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getSetharesDissonance()

float Chord::getSetharesDissonance ( const int  numPartialsPerNote = 6,
const bool  useMinModel = true,
const std::function< std::vector< float >(std::vector< float >)>  amplCallback = nullptr,
const float  partialsDecayExpRate = 0.88f,
const std::function< float(std::vector< float >)>  dissCallback = nullptr 
) const

Calculates the total Sethares dissonance for the chord.

Aggregates the dissonance values for all dyads, optionally using a custom aggregation function.

Parameters
numPartialsPerNoteNumber of partials per note.
useMinModelIf true, uses the minimum amplitude model; otherwise, uses the product.
amplCallbackOptional: function to modify amplitude vector.
partialsDecayExpRateOptional Partials decay exponential rate (default: 0.88).
dissCallbackOptional: function to aggregate dissonance values (e.g., mean, max).
Returns
Total dissonance as a float.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getSetharesDyadsDissonanceValue()

SetharesDissonanceTable Chord::getSetharesDyadsDissonanceValue ( const int  numPartials = 6,
const bool  useMinModel = true,
const std::function< std::vector< float >(std::vector< float >)>  amplCallback = nullptr,
const float  partialsDecayExpRate = 0.88f 
) const

Calculates the Sethares dissonance value for all dyads in the chord.

Parameters
numPartialsNumber of partials per note.
useMinModelIf true, uses the minimum amplitude model; otherwise, uses the product.
amplCallbackOptional: function to modify amplitude vector.
partialsDecayExpRateOptional Partials decay exponential rate (default: 0.88).
Returns
Table with detailed dissonance information for each dyad.

Computes psychoacoustic sensory dissonance using the Sethares spectral dissonance model, which quantifies roughness perception arising from critical band interactions between harmonic partials. The model calculates dissonance for all unique dyads (note pairs) in the chord by analyzing beating patterns and frequency proximity effects.

Dissonance Calculation Process:

  1. Generate harmonic spectra for each note (fundamental + overtones)
  2. For each dyad, compute pairwise partial interactions
  3. Apply critical band masking curves (Plomp-Levelt dissonance function)
  4. Weight contributions by partial amplitudes
  5. Aggregate dissonance values across all dyads

Parameters:

  • numPartials: Higher values increase spectral accuracy but computational cost. Typical range: 6-10 for realistic timbral modeling.
  • useMinModel: Amplitude weighting strategy
    • true: min(amp1, amp2) - assumes weaker partial dominates perception
    • false: amp1 × amp2 - assumes multiplicative interaction
  • amplCallback: Custom spectral envelope shaping (e.g., formant filtering, instrument-specific harmonic rolloff). Input/output: vector of partial amplitudes.
  • partialsDecayExpRate: Exponential decay rate for overtone amplitudes. Default 0.88 models typical harmonic decay (~-1.5 dB per partial).

Return Value: SetharesDissonanceTable containing per-dyad dissonance values, enabling:

  • Identification of most/least dissonant intervals in the chord
  • Voice-leading optimization (minimize dissonance motion)
  • Timbral dissonance profiling across different tuning systems

Applications:

  • Microtonal harmony analysis (optimal tuning selection)
  • Orchestration timbre studies (spectral clash identification)
  • Historical tuning system comparisons (just intonation vs. equal temperament)
  • Consonance/dissonance trajectory analysis in harmonic progressions
Note
This model reflects sensory (psychoacoustic) dissonance, NOT tonal/functional dissonance. A dominant seventh chord (functionally dissonant in tonal theory) may have low Sethares dissonance due to its harmonic series alignment.
Warning
Computational complexity is O(n² × p²) where n = number of notes, p = numPartials. Use sparingly in real-time applications for large chords.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ getStackedHeaps()

std::vector< HeapData > Chord::getStackedHeaps ( const bool  enharmonyNotes = false)

Get all possible stacked heaps (enharmonic variants) for the chord.

Parameters
enharmonyNotesIf true, considers enharmonic equivalents.
Returns
Vector of HeapData representing all possible stacks.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveAugmentedFifth()

bool Chord::haveAnyOctaveAugmentedFifth ( const bool  useEnharmony = false) const

Checks if the chord contains an augmented fifth interval between any two notes, ignoring octave differences.

Returns true if any pair of notes forms an augmented fifth interval, regardless of their octave placement. This method abstracts away octave information and considers only pitch class relationships. Useful for detecting altered harmonies in any register.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if an augmented fifth (any octave) is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveAugmentedFourth()

bool Chord::haveAnyOctaveAugmentedFourth ( const bool  useEnharmony = false) const

Checks if the chord contains an augmented fourth interval between any two notes, ignoring octave differences.

Returns true if any pair of notes forms an augmented fourth (tritone) interval, regardless of their octave placement. This method abstracts away octave information and considers only pitch class relationships. Useful for detecting tritones in any register.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if an augmented fourth (any octave) is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveAugmentedOctave()

bool Chord::haveAnyOctaveAugmentedOctave ( const bool  useEnharmony = false) const

Checks if the chord contains an augmented octave interval between any two notes, ignoring octave differences.

Returns true if any pair of notes forms an augmented octave interval, regardless of their octave placement. This method abstracts away octave information and considers only pitch class relationships. Useful for detecting rare or microtonal relationships in any register.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if an augmented octave (any octave) is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveDiminishedFifth()

bool Chord::haveAnyOctaveDiminishedFifth ( const bool  useEnharmony = false) const

Checks if the chord contains a diminished fifth interval between any two notes, ignoring octave differences.

Returns true if any pair of notes forms a diminished fifth (tritone) interval, regardless of their octave placement. This method abstracts away octave information and considers only pitch class relationships. Useful for detecting tritones in any register.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a diminished fifth (any octave) is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveDiminishedOctave()

bool Chord::haveAnyOctaveDiminishedOctave ( const bool  useEnharmony = false) const

Checks if the chord contains a diminished octave interval between any two notes, ignoring octave differences.

Returns true if any pair of notes forms a diminished octave interval, regardless of their octave placement. This method abstracts away octave information and considers only pitch class relationships. Useful for detecting rare or microtonal relationships in any register.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a diminished octave (any octave) is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveDiminishedSeventh()

bool Chord::haveAnyOctaveDiminishedSeventh ( const bool  useEnharmony = false) const

Checks if the chord contains a diminished seventh interval between any two notes, ignoring octave differences.

Returns true if any pair of notes forms a diminished seventh interval, regardless of their octave placement. This method abstracts away octave information and considers only pitch class relationships. Useful for detecting diminished harmonies in any register.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a diminished seventh (any octave) is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveFifth()

bool Chord::haveAnyOctaveFifth ( ) const

Checks if the chord contains a generic fifth interval (perfect, augmented, or diminished, any octave).

Useful for identifying quintal relationships between any two notes, regardless of octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if any fifth interval is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveFourth()

bool Chord::haveAnyOctaveFourth ( ) const

Checks if the chord contains a generic fourth interval (perfect, augmented, or diminished, any octave).

Useful for identifying quartal relationships between any two notes, regardless of octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if any fourth interval is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveMajorSecond()

bool Chord::haveAnyOctaveMajorSecond ( const bool  useEnharmony = false) const

Checks if the chord contains a major second interval between any two notes, ignoring octave differences.

Returns true if any pair of notes forms a major second interval, regardless of their octave placement. This method abstracts away octave information and considers only pitch class relationships. Useful for detecting stepwise motion or clusters in any register.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a major second (any octave) is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveMajorSeventh()

bool Chord::haveAnyOctaveMajorSeventh ( const bool  useEnharmony = false) const

Checks if the chord contains a major seventh interval between any two notes, ignoring octave differences.

Returns true if any pair of notes forms a major seventh interval, regardless of their octave placement. This method abstracts away octave information and considers only pitch class relationships. Useful for detecting major seventh chords in any register.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a major seventh (any octave) is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveMajorSixth()

bool Chord::haveAnyOctaveMajorSixth ( const bool  useEnharmony = false) const

Checks if the chord contains a major sixth interval between any two notes, ignoring octave differences.

Returns true if any pair of notes forms a major sixth interval, regardless of their octave placement. This method abstracts away octave information and considers only pitch class relationships. Useful for detecting extended tertian harmonies in any register.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a major sixth (any octave) is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveMajorThird()

bool Chord::haveAnyOctaveMajorThird ( const bool  useEnharmony = false) const

Checks if the chord contains a major third interval between any two notes, ignoring octave differences.

Returns true if any pair of notes forms a major third interval, regardless of their octave placement. This method abstracts away octave information and considers only pitch class relationships. Useful for detecting tertian relationships in any register.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a major third (any octave) is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveMinorSecond()

bool Chord::haveAnyOctaveMinorSecond ( const bool  useEnharmony = false) const

Checks if the chord contains a minor second interval between any two notes, ignoring octave differences.

Returns true if any pair of notes forms a minor second interval, regardless of their octave placement. This method abstracts away octave information and considers only pitch class relationships. Useful for detecting clusters or dissonant relationships in any register.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a minor second (any octave) is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveMinorSeventh()

bool Chord::haveAnyOctaveMinorSeventh ( const bool  useEnharmony = false) const

Checks if the chord contains a minor seventh interval between any two notes, ignoring octave differences.

Returns true if any pair of notes forms a minor seventh interval, regardless of their octave placement. This method abstracts away octave information and considers only pitch class relationships. Useful for detecting seventh chords in any register.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a minor seventh (any octave) is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveMinorSixth()

bool Chord::haveAnyOctaveMinorSixth ( const bool  useEnharmony = false) const

Checks if the chord contains a minor sixth interval between any two notes, ignoring octave differences.

Returns true if any pair of notes forms a minor sixth interval, regardless of their octave placement. This method abstracts away octave information and considers only pitch class relationships. Useful for detecting extended tertian harmonies in any register.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a minor sixth (any octave) is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveMinorThird()

bool Chord::haveAnyOctaveMinorThird ( const bool  useEnharmony = false) const

Checks if the chord contains a minor third interval between any two notes, ignoring octave differences.

Returns true if any pair of notes forms a minor third interval, regardless of their octave placement. This method abstracts away octave information and considers only pitch class relationships. Useful for detecting tertian relationships in any register.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a minor third (any octave) is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveOctave()

bool Chord::haveAnyOctaveOctave ( ) const

Checks if the chord contains a generic octave interval (perfect, augmented, or diminished, any octave).

Useful for identifying doubled notes or octave relationships.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if any octave interval is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctavePerfectFifth()

bool Chord::haveAnyOctavePerfectFifth ( const bool  useEnharmony = false) const

Checks if the chord contains a perfect fifth interval between any two notes, ignoring octave differences.

Returns true if any pair of notes forms a perfect fifth interval, regardless of their octave placement. This method abstracts away octave information and considers only pitch class relationships. Useful for detecting quintal harmonies in any register.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a perfect fifth (any octave) is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctavePerfectFourth()

bool Chord::haveAnyOctavePerfectFourth ( const bool  useEnharmony = false) const

Checks if the chord contains a perfect fourth interval between any two notes, ignoring octave differences.

Returns true if any pair of notes forms a perfect fourth interval, regardless of their octave placement. This method abstracts away octave information and considers only pitch class relationships. Useful for detecting quartal harmonies in any register.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a perfect fourth (any octave) is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctavePerfectOctave()

bool Chord::haveAnyOctavePerfectOctave ( const bool  useEnharmony = false) const

Checks if the chord contains a perfect octave interval between any two notes, ignoring octave differences.

Returns true if any pair of notes forms a perfect octave interval, regardless of their octave placement. This method abstracts away octave information and considers only pitch class relationships. Useful for detecting doubled notes in any register.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a perfect octave (any octave) is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveSecond()

bool Chord::haveAnyOctaveSecond ( ) const

Checks if the chord contains a generic second interval (major or minor, any octave).

Useful for identifying stepwise relationships between any two notes, regardless of octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if any second interval is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveSeventh()

bool Chord::haveAnyOctaveSeventh ( ) const

Checks if the chord contains a generic seventh interval (major, minor, or diminished, any octave).

Useful for identifying seventh chords or complex harmonies.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if any seventh interval is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveSixth()

bool Chord::haveAnyOctaveSixth ( ) const

Checks if the chord contains a generic sixth interval (major or minor, any octave).

Useful for identifying extended tertian or added-sixth harmonies.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if any sixth interval is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAnyOctaveThird()

bool Chord::haveAnyOctaveThird ( ) const

Checks if the chord contains a generic third interval (major or minor, any octave).

Useful for identifying tertian relationships between any two notes, regardless of octave.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if any third interval is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAugmentedFifth()

bool Chord::haveAugmentedFifth ( const bool  useEnharmony = false)

Checks if the chord contains an augmented fifth interval (e.g., C and G#).

Indicates the presence of augmented chords or altered dominants.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if an augmented fifth is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAugmentedFourth()

bool Chord::haveAugmentedFourth ( const bool  useEnharmony = false)

Checks if the chord contains an augmented fourth interval (tritone, e.g., C and F#).

The tritone is a key interval in dominant and diminished harmonies.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if an augmented fourth is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAugmentedInterval()

bool Chord::haveAugmentedInterval ( const bool  useEnharmony = false) const

Check if the chord contains at least one augmented interval.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if an augmented interval exists.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAugmentedOctave()

bool Chord::haveAugmentedOctave ( const bool  useEnharmony = false)

Checks if the chord contains an augmented octave interval (e.g., C and C# an octave apart).

Rare, but may occur in complex or microtonal harmonies.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if an augmented octave is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveAugmentedUnisson()

bool Chord::haveAugmentedUnisson ( const bool  useEnharmony = false) const

Checks if the chord contains an augmented unison interval (e.g., C and C#).

Useful for detecting chromatic clusters or extended harmonies.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if an augmented unison is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveDiminishedFifth()

bool Chord::haveDiminishedFifth ( const bool  useEnharmony = false)

Checks if the chord contains a diminished fifth interval (tritone, e.g., C and Gb).

The tritone is a key interval in dominant and diminished harmonies.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a diminished fifth is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveDiminishedInterval()

bool Chord::haveDiminishedInterval ( const bool  useEnharmony = false) const

Check if the chord contains at least one diminished interval.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a diminished interval exists.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveDiminishedOctave()

bool Chord::haveDiminishedOctave ( const bool  useEnharmony = false)

Checks if the chord contains a diminished octave interval (e.g., C and Cb an octave apart).

Rare, but may occur in complex or microtonal harmonies.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a diminished octave is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveDiminishedSeventh()

bool Chord::haveDiminishedSeventh ( const bool  useEnharmony = false)

Checks if the chord contains a diminished seventh interval (e.g., C and Bbb).

Characteristic of diminished seventh chords.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a diminished seventh is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveDiminishedUnisson()

bool Chord::haveDiminishedUnisson ( const bool  useEnharmony = false) const

Checks if the chord contains a diminished unison interval (e.g., C and Cb).

Useful for identifying chromatic clusters or microtonal chords.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a diminished unison is present between any two notes.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveEleventh()

bool Chord::haveEleventh ( const bool  useEnharmony = false) const

Checks if the chord contains any eleventh interval (perfect or sharp) between its notes.

Returns true if there is at least one interval of an eleventh (perfect or sharp) between any two notes in the chord. Useful for identifying 11th chords and complex extensions.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if an eleventh interval is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveFifth()

bool Chord::haveFifth ( const bool  useEnharmony = false) const

Checks if the chord contains any fifth interval (perfect, augmented, or diminished) between its notes.

Returns true if there is at least one interval of a fifth (of any quality) between any two notes in the chord, regardless of octave. Useful for identifying quintal harmonies or power chords.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a fifth interval is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveFourth()

bool Chord::haveFourth ( const bool  useEnharmony = false) const

Checks if the chord contains any fourth interval (perfect, augmented, or diminished) between its notes.

Returns true if there is at least one interval of a fourth (of any quality) between any two notes in the chord, regardless of octave. Useful for identifying quartal harmonies or sus chords.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a fourth interval is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveMajorInterval()

bool Chord::haveMajorInterval ( const bool  useEnharmony = false) const

Check if the chord contains at least one major interval.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a major interval exists.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveMajorNinth()

bool Chord::haveMajorNinth ( const bool  useEnharmony = false)

Checks if the chord contains a major ninth interval (e.g., C and D an octave apart).

Useful for identifying extended harmonies (e.g., 9th chords).

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a major ninth is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveMajorSecond()

bool Chord::haveMajorSecond ( const bool  useEnharmony = false)

Checks if the chord contains a major second interval (e.g., C and D).

Useful for analyzing stepwise motion or clusters.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a major second is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveMajorSeventh()

bool Chord::haveMajorSeventh ( const bool  useEnharmony = false)

Checks if the chord contains a major seventh interval (e.g., C and B).

Essential for major seventh chords.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a major seventh is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveMajorSixth()

bool Chord::haveMajorSixth ( const bool  useEnharmony = false)

Checks if the chord contains a major sixth interval (e.g., C and A).

Useful for identifying extended harmonies and voice leading.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a major sixth is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveMajorThird()

bool Chord::haveMajorThird ( const bool  useEnharmony = false)

Checks if the chord contains a major third interval (e.g., C and E).

Essential for identifying major triads and seventh chords.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a major third is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveMajorThirdteenth()

bool Chord::haveMajorThirdteenth ( const bool  useEnharmony = false)

Checks if the chord contains a major thirteenth interval (e.g., C and A two octaves plus a sixth apart).

Useful for identifying 13th chords and complex extensions.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a major thirteenth is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveMinorInterval()

bool Chord::haveMinorInterval ( const bool  useEnharmony = false) const

Check if the chord contains at least one minor interval.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a minor interval exists.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveMinorNinth()

bool Chord::haveMinorNinth ( const bool  useEnharmony = false)

Checks if the chord contains a minor ninth interval (e.g., C and Db an octave apart).

Useful for identifying extended harmonies (e.g., 9th chords).

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a minor ninth is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveMinorSecond()

bool Chord::haveMinorSecond ( const bool  useEnharmony = false)

Checks if the chord contains a minor second interval (e.g., C and Db).

Identifies the presence of the smallest diatonic interval, often associated with dissonance.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a minor second is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveMinorSeventh()

bool Chord::haveMinorSeventh ( const bool  useEnharmony = false)

Checks if the chord contains a minor seventh interval (e.g., C and Bb).

Essential for minor seventh and dominant seventh chords.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a minor seventh is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveMinorSixth()

bool Chord::haveMinorSixth ( const bool  useEnharmony = false)

Checks if the chord contains a minor sixth interval (e.g., C and Ab).

Useful for identifying extended harmonies and voice leading.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a minor sixth is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveMinorThird()

bool Chord::haveMinorThird ( const bool  useEnharmony = false)

Checks if the chord contains a minor third interval (e.g., C and Eb).

Essential for identifying minor triads and seventh chords.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a minor third is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveMinorThirdteenth()

bool Chord::haveMinorThirdteenth ( const bool  useEnharmony = false)

Checks if the chord contains a minor thirteenth interval (e.g., C and Ab two octaves plus a sixth apart).

Useful for identifying 13th chords and complex extensions.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a minor thirteenth is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveNinth()

bool Chord::haveNinth ( const bool  useEnharmony = false) const

Checks if the chord contains any ninth interval (major or minor) between its notes.

Returns true if there is at least one interval of a ninth (major or minor) between any two notes in the chord. Useful for identifying extended harmonies such as 9th chords.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a ninth interval is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveOctave()

bool Chord::haveOctave ( const bool  useEnharmony = false) const

Checks if the chord contains any octave interval (perfect, augmented, or diminished) between its notes.

Returns true if there is at least one interval of an octave (of any quality) between any two notes in the chord. Useful for identifying doubled notes or octave relationships.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if an octave interval is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ havePerfectEleventh()

bool Chord::havePerfectEleventh ( const bool  useEnharmony = false)

Checks if the chord contains a perfect eleventh interval (e.g., C and F two octaves apart).

Useful for identifying 11th chords and complex extensions.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a perfect eleventh is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ havePerfectFifth()

bool Chord::havePerfectFifth ( const bool  useEnharmony = false)

Checks if the chord contains a perfect fifth interval (e.g., C and G).

The perfect fifth is fundamental to tonal harmony and chord structure.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a perfect fifth is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ havePerfectFourth()

bool Chord::havePerfectFourth ( const bool  useEnharmony = false)

Checks if the chord contains a perfect fourth interval (e.g., C and F).

Useful for quartal harmonies and sus chords.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a perfect fourth is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ havePerfectInterval()

bool Chord::havePerfectInterval ( const bool  useEnharmony = false) const

Check if the chord contains at least one perfect interval.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a perfect interval exists.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ havePerfectOctave()

bool Chord::havePerfectOctave ( const bool  useEnharmony = false)

Checks if the chord contains a perfect octave interval (e.g., C4 and C5).

Indicates the presence of doubled notes in different octaves.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a perfect octave is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ havePerfectUnisson()

bool Chord::havePerfectUnisson ( const bool  useEnharmony = false) const

Checks if the chord contains a perfect unison interval (e.g., two notes with the same pitch).

Indicates the presence of doubled notes in the chord.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a perfect unison is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveSecond()

bool Chord::haveSecond ( const bool  useEnharmony = false) const

Checks if the chord contains any second interval (major or minor) between its notes.

Returns true if there is at least one interval of a second (major or minor) between any two notes in the chord, regardless of octave. This is useful for identifying stepwise relationships within the chord's structure.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a second interval is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveSeventh()

bool Chord::haveSeventh ( const bool  useEnharmony = false) const

Checks if the chord contains any seventh interval (major, minor, or diminished) between its notes.

Returns true if there is at least one interval of a seventh (of any quality) between any two notes in the chord, regardless of octave. Useful for identifying seventh chords and complex harmonies.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a seventh interval is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveSharpEleventh()

bool Chord::haveSharpEleventh ( const bool  useEnharmony = false)

Checks if the chord contains a sharp eleventh interval (e.g., C and F# two octaves apart).

Useful for identifying altered dominants and Lydian harmonies.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a sharp eleventh is present.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveSixth()

bool Chord::haveSixth ( const bool  useEnharmony = false) const

Checks if the chord contains any sixth interval (major or minor) between its notes.

Returns true if there is at least one interval of a sixth (major or minor) between any two notes in the chord, regardless of octave. Useful for identifying extended tertian harmonies.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a sixth interval is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveThird()

bool Chord::haveThird ( const bool  useEnharmony = false) const

Checks if the chord contains any third interval (major or minor) between its notes.

Returns true if there is at least one interval of a third (major or minor) between any two notes in the chord, regardless of octave. This is useful for identifying tertian (third-based) relationships within the chord.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a third interval is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ haveThirdteenth()

bool Chord::haveThirdteenth ( const bool  useEnharmony = false) const

Checks if the chord contains any thirteenth interval (major or minor) between its notes.

Returns true if there is at least one interval of a thirteenth (major or minor) between any two notes in the chord. Useful for identifying 13th chords and complex extensions.

Parameters
useEnharmonyIf true, considers enharmonic equivalents.
Returns
True if a thirteenth interval is present, false otherwise.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ info()

void Chord::info ( )

Prints detailed information about the chord, including name, size, notes, and stack.

Useful for analysis and debugging.

Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ insertNote()

void Chord::insertNote ( Note insertNote,
int  positionNote = 0 
)

Insert a note at a specific position in the chord.

Parameters
insertNoteThe note to insert.
positionNoteThe index at which to insert the note.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ isAugmentedChord()

bool Chord::isAugmentedChord ( )

Determines if the chord is an augmented triad.

Augmented triads contain a root, major third, and augmented fifth.

Returns
True if the chord is an augmented triad.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ isDiminishedChord()

bool Chord::isDiminishedChord ( )

Determines if the chord is a diminished triad.

Diminished triads contain a root, minor third, and diminished fifth.

Returns
True if the chord is a diminished triad.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ isDominantSeventhChord()

bool Chord::isDominantSeventhChord ( )

Determines if the chord is a dominant seventh chord.

Dominant sevenths contain a root, major third, perfect fifth, and minor seventh.

Returns
True if the chord is a dominant seventh.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ isDyad()

bool Chord::isDyad ( )

Determines if the chord is a dyad (contains exactly two distinct notes).

Dyads are the simplest harmonic structures, often analyzed as intervals.

Returns
True if the chord is a dyad.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ isHalfDiminishedChord()

bool Chord::isHalfDiminishedChord ( )

Determines if the chord is a half-diminished seventh chord.

Half-diminished chords contain a root, minor third, diminished fifth, and minor seventh.

Returns
True if the chord is half-diminished.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ isInRootPosition()

bool Chord::isInRootPosition ( )

Checks if the chord is in root position (lowest note is the root).

Compares the pitch class of the lowest note with the root of the closed stack.

Returns
True if the chord is in root position.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ isMajorChord()

bool Chord::isMajorChord ( )

Determines if the chord is a major triad.

Major triads contain a root, major third, and perfect fifth.

Returns
True if the chord is a major triad.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ isMinorChord()

bool Chord::isMinorChord ( )

Determines if the chord is a minor triad.

Minor triads contain a root, minor third, and perfect fifth.

Returns
True if the chord is a minor triad.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ isSorted()

bool Chord::isSorted ( ) const

Checks if the notes in the chord are sorted in ascending order by MIDI number.

Useful for ensuring consistent interval calculations and for algorithms that require sorted input.

Returns
True if the notes are sorted from lowest to highest pitch.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ isSus()

bool Chord::isSus ( )

Determines if the chord is a suspended chord (sus2 or sus4).

Suspended chords replace the third with a second or fourth, creating a characteristic open sound.

Returns
True if the chord is a sus chord.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ isTonal()

bool Chord::isTonal ( std::function< bool(const Chord &chord)>  model = nullptr)

Determines if the chord is tonal according to a given model or default rules.

Parameters
modelOptional: a function that takes a Chord and returns true if it is tonal.
Returns
True if the chord is considered tonal.

Evaluates whether the chord conforms to tonal harmonic principles based on its intervallic content in closed-stack configuration. Two evaluation modes:

Default Model (model = nullptr): Analyzes all intervals in the closed stack and verifies they belong to the tonal interval inventory:

  • Consonances: perfect unison/octave (P1/P8), perfect fifth (P5), perfect fourth (P4), major/minor thirds (M3/m3), major/minor sixths (M6/m6)
  • Diatonic dissonances: major/minor seconds (M2/m2), major/minor sevenths (M7/m7)

Returns false if ANY interval is:

  • Augmented or diminished (except diminished fifth in dominant seventh contexts)
  • Microtonal or non-12TET intervals
  • Extended jazz intervals beyond the 13th

Custom Model: Allows user-defined tonality criteria via callback function. Useful for:

  • Period-specific tonality rules (Renaissance vs. Romantic harmony)
  • Genre-specific harmonic syntax (jazz altered dominants, modal harmony)
  • Experimental tonal systems (extended tonality, pandiatonicism)

Applications:

  • Identifying tonal vs. atonal/post-tonal harmonic regions in scores
  • Filtering tonal subsets from chromatic harmonic progressions
  • Analyzing functional harmonic syntax vs. non-functional chromaticism
  • Historical style analysis (tonal practice across musical periods)
Note
This function operates on the closed-stack representation, ensuring consistent tonality evaluation regardless of chord voicing or register.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ isWholeDiminishedChord()

bool Chord::isWholeDiminishedChord ( )

Determines if the chord is a fully diminished seventh chord.

Fully diminished chords contain a root, minor third, diminished fifth, and diminished seventh.

Returns
True if the chord is fully diminished.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ operator!=()

bool Chord::operator!= ( const Chord otherChord) const
inline

Inequality operator comparing chords by pitch-space note ordering.

Parameters
otherChordChord to compare against.
Returns
True if chords differ in size or contain non-identical notes at any position.

Logical negation of operator==. Returns true if chords are not pitch-wise identical in their original note ordering. Inequality holds if:

  1. Chord cardinalities differ (different number of notes), OR
  2. Any corresponding note pair differs (Note::operator!=)

This is a strict pitch-space inequality preserving registral distinctions. Does NOT account for:

  • Harmonic function equivalence (e.g., inversions of the same chord)
  • Enharmonic equivalence (e.g., C# vs. Db)
  • Pitch-class set equivalence under transposition/inversion

For functional harmonic analysis, use chord quality/root comparison methods instead.

Note
Two chords may be harmonically equivalent but still return true for inequality if their voicings differ (e.g., C4-E4-G4 vs. E4-G4-C5).
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ operator==()

bool Chord::operator== ( const Chord otherChord) const
inline

Equality operator comparing chords by pitch-space note ordering.

Parameters
otherChordChord to compare against.
Returns
True if both chords contain identical notes in the same original order.

Performs pitch-wise equality comparison using the original (unsorted) note sequence. Two chords are considered equal if and only if:

  1. They contain the same number of notes (cardinality equality)
  2. Each corresponding note pair is identical (Note::operator==)

This is a strict pitch-space comparison that preserves registral and voice-leading relationships. It does NOT compare:

  • Closed-stack or root-position equivalence
  • Pitch-class set equivalence (enharmonic equivalence)
  • Inversional or transpositional equivalence

For harmonic function equivalence analysis (e.g., comparing C-E-G vs. E-G-C as both being C major triads), use getPitchClassSet() or getChordName() instead.

Note
Enharmonic notes (e.g., C# vs. Db) are NOT considered equal by this operator, as Note::operator== performs exact pitch-class comparison.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ operator[]() [1/2]

Note & Chord::operator[] ( size_t  index)
inline

Array subscript operator for mutable access to notes in original (unsorted) order.

Parameters
indexZero-based index of the note to retrieve (0 ≤ index < size()).
Returns
Mutable reference to the Note at the specified index position.
Exceptions
std::out_of_rangeif index >= size().

Allows modification of notes while preserving their positional order. Changes to individual notes do not automatically update cached harmonic analysis results—those are recomputed on demand. Use for transposition, dynamic modification, articulation changes, or other note-level edits.

◆ operator[]() [2/2]

const Note & Chord::operator[] ( size_t  index) const
inline

Array subscript operator for read-only access to notes in original (unsorted) order.

Parameters
indexZero-based index of the note to retrieve (0 ≤ index < size()).
Returns
Const reference to the Note at the specified index position.
Exceptions
std::out_of_rangeif index >= size().

Provides direct access to notes in their original input order, preserving the vertical arrangement as specified in MusicXML or programmatic construction. Does not reflect sorted or closed-stack ordering used in harmonic analysis. Useful for voice-leading analysis, pitch-space operations, and preserving registral relationships.

Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ print()

void Chord::print ( ) const

Prints the pitches of all notes in the chord to the log.

Useful for debugging and inspection.

Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ printStack()

void Chord::printStack ( ) const

Prints the pitches of all notes in the open stack to the log.

Useful for debugging and inspection of the stacked chord.

Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ removeNote()

void Chord::removeNote ( int  noteIndex)

Remove a note at a specific index from the chord.

Parameters
noteIndexIndex of the note to remove.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ setDuration() [1/2]

void Chord::setDuration ( const Duration duration)

Set the duration for all notes in the chord.

Parameters
durationThe Duration object to assign.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ setDuration() [2/2]

void Chord::setDuration ( const float  quarterDuration,
const int  divisionsPerQuarterNote = 256 
)

Set the duration for all notes in the chord using quarter note value.

Parameters
quarterDurationDuration in quarter notes.
divisionsPerQuarterNoteDivisions per quarter note (default: 256).

◆ size()

int Chord::size ( ) const

Returns the number of notes in the chord.

Equivalent to the size of the original notes vector.

Returns
Number of notes in the chord.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ sortNotes()

void Chord::sortNotes ( )

Sorts the notes in the chord in ascending order by MIDI number.

Useful for ensuring consistent interval calculations and for algorithms that require sorted input.

Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ stackSize()

int Chord::stackSize ( )

Returns the number of notes in the open stack (after stacking in thirds).

Triggers stacking if not already performed.

Returns
Number of notes in the open stack.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ toCents()

std::vector< int > Chord::toCents ( ) const

Returns a vector with the intervals (in cents) between each pair of adjacent notes in the chord.

Useful for microtonal and tuning analysis, as well as for comparing intervallic content.

Returns
Vector of integer values representing the interval in cents between each note pair.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ toInversion()

void Chord::toInversion ( int  inversionNumber)

Invert the chord by moving the lowest note up by one octave, repeated inversionNumber times.

Parameters
inversionNumberNumber of inversions to perform.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ transpose()

void Chord::transpose ( const int  semiTonesNumber)

Transpose all notes in the chord by a number of semitones.

Parameters
semiTonesNumberNumber of semitones to transpose.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

◆ transposeStackOnly()

void Chord::transposeStackOnly ( const int  semiTonesNumber)

Transpose only the stacked (open) version of the chord by a number of semitones.

Parameters
semiTonesNumberNumber of semitones to transpose.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const Chord chord 
)
friend

Output stream operator for Chord. Prints the chord as a list of pitches.

Parameters
osOutput stream.
chordChord to print.
Returns
Reference to the output stream.
Examples
C:/Users/nyck/Desktop/maialib/maiacore/include/maiacore/chord.h.

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