I have recently been searching for a formula to determine the octave a note is in, given the number of that key on the piano. For example, given the key #77 (C7# for reference), how could I mathematically determine its octave number?
So far, I have tried dividing by 12 and 13, rounding to the nearest whole, since there are 12-13 notes in an octave (counting black and white keys), depending if you include the repeat of the first note or not.
Any ideas? Thank you!