optimizing code: help avoiding modulus..

If pitch is a known constant, it can be made easier.

in the first post of OP - pitch is set in set_freq() outside the Interrupt routine, so it is possibly not constant