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));
43inline ChordCandidateCategory &
44operator|= (ChordCandidateCategory &a, ChordCandidateCategory b)
noexcept
51enum class HarmonicFunction
60enum class CandidateType
79 MusicalNote root_note = MusicalNote::C;
80 ChordType type = ChordType::Major;
81 ChordAccent accent = ChordAccent::None;
83 bool operator== (
const ChordKey &other)
const
85 return root_note == other.root_note && type == other.type
86 && accent == other.accent;
100 CandidateType type = CandidateType::DiatonicTriad;
101 int scale_degree = -1;
102 std::optional<int> secondary_dominant_target_degree{};
109 CandidateType candidate_type = CandidateType::DiatonicTriad;
110 float overall_score = 0.0f;
111 float functional_score = 0.0f;
112 float root_motion_score = 0.0f;
113 float voice_leading_score = 0.0f;
114 int scale_degree = -1;
115 HarmonicFunction function = HarmonicFunction::Other;
129get_scale_degree (MusicalNote root,
const MusicalScale &scale);
133score_root_motion (MusicalNote prev_root, MusicalNote next_root);
145score_functional_compatibility (
153score_seventh_resolution (
160score_secondary_dominant (
167score_leading_tone_resolution (
183std::vector<CandidateChord>
186 ChordCandidateCategory categories);
189std::vector<ChordSuggestion>
193 ChordCandidateCategory categories,
194 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.