When the main checking function has detected a note error, next state reception will call the sub-function mididetector_checknoteerror which implements the following algorithm:
BEGIN
for (all detected errors since last check)
index_offset = index(lastFollowedNote) - index(previousFollowedNote)
if (index_offset == (number of detected errors since last check) + 1)
if (pitch(lastPlayedNote) == pitch(nextExpectedNote)
Error = type SKIP NOTE
else
Error = type WRONG NOTE
endif
else
Error = type ADDED NOTE
endif
end for
END