Generate an accompaniement for a given melody
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MusicRules.hpp
1 #ifndef MUSICRULES_HPP_INCLUDED
2 #define MUSICRULES_HPP_INCLUDED
3 #include <functional>
4 #include <vector>
5 #include <map>
6 
7 #include "Music.hpp"
8 #include "Utilities.hpp"
9 
10 using ExprA = std::function<Number(const std::map<std::string, Number>&)>;
11 
12 using Rule0 = std::vector<Number>;
13 using Rule1 = ExprA;
14 using Rule2 = ExprA;
15 using Rule3 = std::pair<ExprA, Number>;
16 using Rule4 = ExprA;
17 using Rule5 = ExprA;
18 using Rule6 = std::vector< std::pair<ChordProgression, Number> >;
19 using M1 = ExprA;
20 using M2 = ExprA;
21 using M3 = ExprA;
22 using M4 = ExprA;
23 
24 
26 {
27  RuleCombination(Rule1, Rule2, Rule3, Rule4, Rule5, Rule6, M1, M2, M3, M4);
28  mutable Rule0 m_r0;
29  Rule1 m_r1;
30  Rule2 m_r2;
31  Rule3 m_r3;
32  Rule4 m_r4;
33  Rule5 m_r5;
34  Rule6 m_r6;
35  M1 m_m1;
36  M2 m_m2;
37  M3 m_m3;
38  M4 m_m4;
39 };
40 
53 ExprA getExprA(const std::string& toParse, const std::vector<std::string>& variables);
54 
57 ExprA getExprA(const std::string& toParse);
58 
75 RuleCombination getRules(const std::string& file, const std::vector<std::string>& ruleNames);
76 
85 ChordProgression getBestChordProgression(const RuleCombination& rules, const MachineLearningOutput& ml, const Melody& melody);
86 ChordProgression scoreChordProgressionBis(const RuleCombination& rules, const MachineLearningOutput& ml, const Melody& melody);
87 
97 ChordProgression getBestChordProgression(const std::string& ruleFile, const std::vector<std::string>& ruleNames, const MachineLearningOutput& ml, const Melody& m, bool bis);
98 
99 
100 
101 #endif
This file defines all the data structures related to music objects.
Describes a melody.
Definition: Music.hpp:629
std::vector< Chord > ChordProgression
ChordProgression is the class used to give the set of chords used.
Definition: Music.hpp:592
Definition: MusicRules.hpp:25