How simple can computation be?
I think harmony can be a single equation:
// get the pattern byte
unsigned short patternByte = qdGetModePatternForPval (aKPDVE [1], partition);
unsigned short answerBitByte = 0x8000;
// SOLUTION FOR *ANY* DVE
answerBitByte >>= (aKPDVE[2] + aKPDVE [3] * aKPDVE [4]) % partition;
// if the answer byte meets the displaced bit in the pattern, shift sharp-side or flat-side
if ((answerBitByte & patternByte) == 0) {
answerBitByte >>= (aKPDVE [1] < 4) ? partition : 12 - partition;
}
// bit shift for K
return circleShiftLowestOctaveRight (answerBitByte, aKPDVE [0]);
