public SevenChord(JustNote baseNote, JustNote thirdNote, JustNote fifthNote, JustNote sevenNote, SevenChordMode mode, SevenChordInversion inv) { ChordNotes[0] = baseNote; ChordNotes[1] = thirdNote; ChordNotes[2] = fifthNote; ChordNotes[3] = sevenNote; Mode = mode; Inversion = inv; }
public SevenChord(JustNote baseNote, int[] theFormula, SevenChordMode mode = SevenChordMode.I, SevenChordInversion inv = SevenChordInversion.I) { ChordType = SevenChordTypes.SevenchordTypes.First(f => f.Value[0] == theFormula[0] && f.Value[1] == theFormula[1] && f.Value[2] == theFormula[2] && f.Value[3] == theFormula[3]).Key.ToString(); ChordNotes[0] = baseNote; var tempNote = baseNote; for (int i = 1; i < 4; i++) { tempNote = JustNote.moveNoteBySemitones(tempNote, theFormula[i - 1]); ChordNotes[i] = tempNote; } Mode = mode; switch (Mode) { case SevenChordMode.I: break; case SevenChordMode.II: ChordNotes[1] = JustNote.moveNoteBySemitones(ChordNotes[1], 12); ChordNotes[3] = JustNote.moveNoteBySemitones(ChordNotes[3], 12); break; case SevenChordMode.III: ChordNotes[2] = JustNote.moveNoteBySemitones(ChordNotes[2], 12); break; case SevenChordMode.IV: ChordNotes[1] = JustNote.moveNoteBySemitones(ChordNotes[1], 12); break; case SevenChordMode.V: ChordNotes[1] = JustNote.moveNoteBySemitones(ChordNotes[1], 12); ChordNotes[2] = JustNote.moveNoteBySemitones(ChordNotes[2], 12); break; case SevenChordMode.VI: ChordNotes[1] = JustNote.moveNoteBySemitones(ChordNotes[1], 24); ChordNotes[2] = JustNote.moveNoteBySemitones(ChordNotes[2], 12); break; default: break; } this.InverseForward(inv); Inversion = inv; }
// TODO : Keep specific chord steps on their place public void InverseForward(SevenChordInversion inv) { var mode = SevenChordTypes.SevenChordModeFormula[Mode]; var b = mode[(0 + (int)inv) % 4]; var c = mode[(1 + (int)inv) % 4]; var d = mode[(2 + (int)inv) % 4]; var a = mode[(3 + (int)inv) % 4]; while (ChordNotes[b].getNoteNumber() > ChordNotes[c].getNoteNumber()) { ChordNotes[c] = JustNote.moveNoteBySemitones(ChordNotes[c], 12); } while (ChordNotes[c].getNoteNumber() > ChordNotes[d].getNoteNumber()) { ChordNotes[d] = JustNote.moveNoteBySemitones(ChordNotes[d], 12); } while (ChordNotes[d].getNoteNumber() > ChordNotes[a].getNoteNumber()) { ChordNotes[a] = JustNote.moveNoteBySemitones(ChordNotes[a], 12); } Inversion = inv; }