Puzzled about bit of code

Oh I wasn't aware that setFreq plays a tone indefinitely. The only thing I can think of is that the MIDI library's timer interrupts are interfering with yours.