public Chord(Intonation root, ChordComplexity complexity, IEnumerable <Interval> intervals) { Root = root; _intervals = intervals.ToList(); var octave = root.GetChromaticOctave().ToList(); switch (complexity) { case ChordComplexity.Triad: Intonations = new List <Intonation> { root, octave[_intervals.GetChromaticIndex(Degree.III)], octave[_intervals.GetChromaticIndex(Degree.V)] }; Type = GetTriadType(); break; case ChordComplexity.Seventh: Intonations = new List <Intonation> { root, octave[_intervals.GetChromaticIndex(Degree.III)], octave[_intervals.GetChromaticIndex(Degree.V)], octave[_intervals.GetChromaticIndex(Degree.VII)] }; Type = GetSeventhType(); break; } }
public static IEnumerable <Intonation> GetIntonations(this IEnumerable <Interval> intervals, Intonation root) { var octave = root.GetChromaticOctave().ToList(); var results = new List <Intonation>(); results.Add(root); var index = 0; foreach (var interval in intervals) { index += (int)interval; if (index >= octave.Count) { continue; } results.Add(octave[index]); } return(results); }
public static Intonation GetIntonation(this IEnumerable <Interval> intervals, Intonation root, Degree degree) => root.GetChromaticOctave().ElementAt(intervals.GetChromaticIndex(degree));