public string ToString(Tonalty tonalty) { if (tonalty.Root == -1) { return(ToString()); } if (Scale == -1) { switch (NonChordType) { case NonChordTypeEnum.NonChord: return("N"); case NonChordTypeEnum.XMark: return("X"); case NonChordTypeEnum.QMark: return("?"); } } int delta = Scale - tonalty.Root; if (delta < 0) { delta += 12; } return(MajMin ? Num2RomeBig[delta] : Num2RomeSmall[delta]); }
public void EstimateGlobalTonalty() { if (GlobalChroma == null) { return; } int[] Adder = new int[] { 0, 2, 4, 5, 7, 9, 11 }; int maxAt = 0; double maxValue = 0; for (int i = 0; i < 12; ++i) { double currentValue = 0; foreach (int j in Adder) { currentValue += GlobalChroma[(i + j) % 12]; } if (currentValue > maxValue) { maxValue = currentValue; maxAt = i; } } int laPos = maxAt - 3 < 0 ? maxAt + 9 : maxAt - 3; Tonalty sampleTonalty = new Tonalty(maxAt, GlobalChroma[laPos] > GlobalChroma[maxAt] ? false : true); foreach (BeatInfo beat in beats) { beat.Tonalty = sampleTonalty; } }
public static Tonalty RelativeTonalty(Tonalty tonalty) { return(new Tonalty(tonalty.Root, !tonalty.MajMin)); }
public BeatInfo() { Tonalty = Tonalty.NoTonalty; ChordTag = Chord.NonChord; }