OCTAVE_NOTES
#define NOCTAVES (int)(__arraycount(pitchtab) / OCTAVE_NOTES)
int lastpitch = OCTAVE_NOTES * DFLT_OCTAVE;
pitch = notetab[c - 'A'] + sc->sc_octave * OCTAVE_NOTES;
if (d > abs(pitch + OCTAVE_NOTES - lastpitch)) {
pitch += OCTAVE_NOTES;
if (d > abs(pitch - OCTAVE_NOTES - lastpitch)) {
pitch -= OCTAVE_NOTES;