/// <summary> /// /// </summary> /// <param name="aScale">Source scale alphabet</param> /// <param name="numStackedThirds">Set to 2 for a normal triad, 3 for a 7th, 4 for a ninth, etc.</param> /// <param name="scaleDegree">1 to 7</param> /// <returns></returns> private static Alphabet GetStackedTriadAlphabetForScaleDegree(Key k, Alphabet aScale, int numStackedThirds, int scaleDegree) { Alphabet aTriad = new Alphabet(); for (int offset = 0; offset <= numStackedThirds * 2; offset += 2) { int stability; switch (offset) { case 0: stability = 3; // root; break; case 4: stability = 2; // 5th break; default: stability = 1; // other thirds break; } ScaleDegreeWithStability sd = new ScaleDegreeWithStability(aScale[(scaleDegree - 1 + offset) % aScale.Count], stability); aTriad.Add(sd); } aTriad.Name = k.GetScaleDegreePitch(aScale[scaleDegree - 1], 4).ToString(); // Get quality of first interval. int pc1 = k.GetScaleDegreePitchClass(aTriad[0]); int pc2 = k.GetScaleDegreePitchClass(aTriad[1]) + 12; int diff = (pc2 - pc1) % 12; if (diff == 3) { aTriad.Name += "m"; } /* if (numStackedThirds == 2) * //aTriad.Name += " triad"; * else */ if (numStackedThirds > 2) { aTriad.Name += (numStackedThirds * 2 + 1).ToString(); //7, 9, etc. for 7th, 9th chords } aTriad.RootScaleDegree = new ScaleDegree(scaleDegree, Alteration.None); aTriad.RootPitchClass = k.GetScaleDegreePitchClass(aTriad.RootScaleDegree); aTriad.StepCollection = false; return(aTriad); }
public object Clone() { Alphabet a = new Alphabet(); foreach (ScaleDegreeWithStability sd in this) { a.Add((ScaleDegreeWithStability)sd.Clone()); } a.Name = Name; a.RootScaleDegree = RootScaleDegree; a.RootPitchClass = RootPitchClass; a.StepCollection = StepCollection; return(a); }
/// <summary> /// Returns an alphabet for a scale in the given key. /// </summary> /// <param name="bass"></param> /// <returns></returns> public static Alphabet GetScaleAlphabet(Key k, bool harmonicMinor = false, bool melodicMinor = false) { Alphabet a = new Alphabet(); for (int i = 1; i < 8; i++) { Alteration alteration = Alteration.None; if (k.Mode == KeyMode.Minor) { if (i == 3 || (i == 6 && !melodicMinor) || (i == 7 && !harmonicMinor && !melodicMinor)) { alteration = Alteration.Lowered; } } int stability; switch (i) { case 1: stability = 3; //root break; case 3: stability = 1; //3rd break; case 5: stability = 2; //dominant break; default: stability = 0; break; } a.Add(new ScaleDegreeWithStability(i, alteration, stability)); } a.Name = k.ToString(); a.RootScaleDegree = new ScaleDegree(1, Alteration.None); a.RootPitchClass = k.GetScaleDegreePitchClass(a.RootScaleDegree); a.StepCollection = true; return(a); }