9#include "dsp/chord_descriptor.h"
10#include "dsp/musical_scale.h"
12namespace zrythm::dsp::chords
20enum class ChordCandidateCategory : uint32_t
22 DiatonicTriads = 1 << 0,
23 DiatonicSevenths = 1 << 1,
24 SecondaryDominants = 1 << 2,
25 BorrowedChords = 1 << 3,
29inline ChordCandidateCategory
30operator| (ChordCandidateCategory a, ChordCandidateCategory b)
noexcept
32 return static_cast<ChordCandidateCategory
> (
33 static_cast<uint32_t
> (a) |
static_cast<uint32_t
> (b));
36inline ChordCandidateCategory
37operator& (ChordCandidateCategory a, ChordCandidateCategory b)
noexcept
39 return static_cast<ChordCandidateCategory
> (
40 static_cast<uint32_t
> (a) &
static_cast<uint32_t
> (b));
44enum class HarmonicFunction
53enum class CandidateType
72 MusicalNote root_note = MusicalNote::C;
73 ChordType type = ChordType::Major;
74 ChordAccent accent = ChordAccent::None;
76 bool operator== (
const ChordKey &other)
const
78 return root_note == other.root_note && type == other.type
79 && accent == other.accent;
93 CandidateType type = CandidateType::DiatonicTriad;
94 int scale_degree = -1;
95 std::optional<int> secondary_dominant_target_degree{};
102 CandidateType candidate_type = CandidateType::DiatonicTriad;
103 float overall_score = 0.0f;
104 float functional_score = 0.0f;
105 float root_motion_score = 0.0f;
106 float voice_leading_score = 0.0f;
107 int scale_degree = -1;
108 HarmonicFunction function = HarmonicFunction::Other;
122get_scale_degree (MusicalNote root,
const MusicalScale &scale);
126score_root_motion (MusicalNote prev_root, MusicalNote next_root);
138score_functional_compatibility (
146score_seventh_resolution (
153score_secondary_dominant (
160score_leading_tone_resolution (
176std::vector<CandidateChord>
179 ChordCandidateCategory categories);
182std::vector<ChordSuggestion>
186 ChordCandidateCategory categories,
187 int max_results = 3);
Describes a musical chord by its root note, type, accent, inversion, and optional bass note.
Musical scale descriptor.
A candidate chord with metadata about how it was generated.
Lightweight POD storing just the chord identity (no QObject overhead).
ChordDescriptor make_descriptor() const
Constructs a temporary ChordDescriptor for method calls.
The result of scoring one candidate chord.