private static int GetStepValue(Pitch aStep) { int value = aStep.Alter; value += aStep.Octave * 12; switch (aStep.Step) { case 'C': return value; case 'D': return value + 2; case 'E': return value + 4; case 'F': return value + 5; case 'G': return value + 7; case 'A': return value + 9; case 'B': return value + 11; default: throw new Exception("invalid pitch value"); } }
private static int GetDelta(Pitch lastPitch, Pitch pitch) { return GetStepValue(pitch) - GetStepValue(lastPitch); }