next-or-previous-note-in-scale function