I'm still testing it, but I think I found an error.
int f;
while(1)
{
f = random( 50, 120);
toneAC(f, 5, 0, true);
delay(100);
noToneAC(); // reset registers
}
The example is okay with the noToneAC() to reset the registers.
Try to remove the noToneAC(), that results in gaps in the sound.
Perhaps the counter has to roll-over ?