Describes a musical chord by its root note, type, accent, inversion, and optional bass note.
More...
#include <src/dsp/chord_descriptor.h>
|
| | ChordDescriptor (QObject *parent=nullptr) |
| | ChordDescriptor (MusicalNote root, ChordType type, ChordAccent accent=ChordAccent::None, int inversion=0, std::optional< MusicalNote > bass=std::nullopt, QObject *parent=nullptr) |
| MusicalNote | rootNote () const |
| void | setRootNote (MusicalNote v) |
| bool | hasBass () const |
| void | setHasBass (bool v) |
| MusicalNote | bassNote () const |
| void | setBassNote (MusicalNote v) |
| ChordType | chordType () const |
| void | setChordType (ChordType v) |
| ChordAccent | chordAccent () const |
| void | setChordAccent (ChordAccent v) |
| int | inversion () const |
| void | setInversion (int v) |
|
QString | displayName () const |
|
Q_SIGNAL void | rootNoteChanged (zrythm::dsp::chords::MusicalNote note) |
|
Q_SIGNAL void | hasBassChanged (bool has) |
|
Q_SIGNAL void | bassNoteChanged (zrythm::dsp::chords::MusicalNote note) |
|
Q_SIGNAL void | chordTypeChanged (zrythm::dsp::chords::ChordType type) |
|
Q_SIGNAL void | chordAccentChanged (zrythm::dsp::chords::ChordAccent accent) |
|
Q_SIGNAL void | inversionChanged (int inversion) |
|
Q_SIGNAL void | displayNameChanged () |
|
Q_SIGNAL void | changed () |
|
Q_INVOKABLE bool | isKeyInChord (MusicalNote key) const |
|
Q_INVOKABLE bool | isKeyBass (MusicalNote key) const |
| boost::container::static_vector< int, kMaxIntervals > | getIntervals () const |
| | Returns the semitone intervals from root for the current type and accent.
|
| ChordPitches | getMidiPitches (std::uint8_t base_pitch=kDefaultBasePitch) const |
| | Returns the MIDI pitches for this chord's voicing.
|
|
int | maxInversion () const |
| int | minInversion () const |
|
utils::Utf8String | to_string () const |
|
bool | isEquivalent (const ChordDescriptor &other) const |
|
|
void | to_json (nlohmann::json &j, const ChordDescriptor &c) |
|
void | from_json (const nlohmann::json &j, ChordDescriptor &c) |
Describes a musical chord by its root note, type, accent, inversion, and optional bass note.
The chord's note content is defined by intervals computed on demand from (type, accent) — no cached derived state.
Definition at line 119 of file chord_descriptor.h.
◆ ChordDescriptor() [1/2]
| zrythm::dsp::ChordDescriptor::ChordDescriptor |
( |
QObject * | parent = nullptr | ) |
|
|
inlineexplicit |
◆ ChordDescriptor() [2/2]
| zrythm::dsp::ChordDescriptor::ChordDescriptor |
( |
MusicalNote | root, |
|
|
ChordType | type, |
|
|
ChordAccent | accent = ChordAccent::None, |
|
|
int | inversion = 0, |
|
|
std::optional< MusicalNote > | bass = std::nullopt, |
|
|
QObject * | parent = nullptr ) |
|
inline |
◆ bassNote()
| MusicalNote zrythm::dsp::ChordDescriptor::bassNote |
( |
| ) |
const |
|
inline |
◆ chordAccent()
| ChordAccent zrythm::dsp::ChordDescriptor::chordAccent |
( |
| ) |
const |
|
inline |
◆ chordType()
| ChordType zrythm::dsp::ChordDescriptor::chordType |
( |
| ) |
const |
|
inline |
◆ get_intervals_for_type_and_accent()
| boost::container::static_vector< int, kMaxIntervals > zrythm::dsp::ChordDescriptor::get_intervals_for_type_and_accent |
( |
ChordType | type, |
|
|
ChordAccent | accent ) |
|
static |
Returns the semitone intervals from root for the given type and accent.
e.g., Major = {0, 4, 7}, Minor7 = {0, 3, 7, 10}
◆ getIntervals()
| boost::container::static_vector< int, kMaxIntervals > zrythm::dsp::ChordDescriptor::getIntervals |
( |
| ) |
const |
Returns the semitone intervals from root for the current type and accent.
e.g., Major = {0, 4, 7}, Minor7 = {0, 3, 7, 10}
◆ getMidiPitches()
| ChordPitches zrythm::dsp::ChordDescriptor::getMidiPitches |
( |
std::uint8_t | base_pitch = kDefaultBasePitch | ) |
const |
Returns the MIDI pitches for this chord's voicing.
Applies octave placement, bass note, and inversion. Stack-allocated, realtime-safe.
◆ hasBass()
| bool zrythm::dsp::ChordDescriptor::hasBass |
( |
| ) |
const |
|
inline |
◆ inversion()
| int zrythm::dsp::ChordDescriptor::inversion |
( |
| ) |
const |
|
inline |
◆ minInversion()
| int zrythm::dsp::ChordDescriptor::minInversion |
( |
| ) |
const |
|
inline |
◆ rootNote()
| MusicalNote zrythm::dsp::ChordDescriptor::rootNote |
( |
| ) |
const |
|
inline |
◆ setBassNote()
| void zrythm::dsp::ChordDescriptor::setBassNote |
( |
MusicalNote | v | ) |
|
|
inline |
◆ setChordAccent()
| void zrythm::dsp::ChordDescriptor::setChordAccent |
( |
ChordAccent | v | ) |
|
|
inline |
◆ setChordType()
| void zrythm::dsp::ChordDescriptor::setChordType |
( |
ChordType | v | ) |
|
|
inline |
◆ setHasBass()
| void zrythm::dsp::ChordDescriptor::setHasBass |
( |
bool | v | ) |
|
|
inline |
◆ setInversion()
| void zrythm::dsp::ChordDescriptor::setInversion |
( |
int | v | ) |
|
|
inline |
◆ setRootNote()
| void zrythm::dsp::ChordDescriptor::setRootNote |
( |
MusicalNote | v | ) |
|
|
inline |
◆ kDefaultBasePitch
| std::uint8_t zrythm::dsp::ChordDescriptor::kDefaultBasePitch = 36 |
|
staticconstexpr |
◆ kMaxIntervals
| size_t zrythm::dsp::ChordDescriptor::kMaxIntervals = 12 |
|
staticconstexpr |
◆ bassNote
| zrythm::dsp::chords::MusicalNote zrythm::dsp::ChordDescriptor::bassNote |
|
readwrite |
◆ chordAccent
| zrythm::dsp::chords::ChordAccent zrythm::dsp::ChordDescriptor::chordAccent |
|
readwrite |
◆ chordType
| zrythm::dsp::chords::ChordType zrythm::dsp::ChordDescriptor::chordType |
|
readwrite |
◆ displayName
| QString zrythm::dsp::ChordDescriptor::displayName |
|
read |
◆ hasBass
| bool zrythm::dsp::ChordDescriptor::hasBass |
|
readwrite |
◆ inversion
| int zrythm::dsp::ChordDescriptor::inversion |
|
readwrite |
◆ rootNote
| zrythm::dsp::chords::MusicalNote zrythm::dsp::ChordDescriptor::rootNote |
|
readwrite |
The documentation for this class was generated from the following file: