I just realized that a program that I am working on could be built in Java. After fixing one or two bugs that happened I ran into this one that I can't fix.
The program plays a beep at faster and faster intervals, and it increases in pitch. I did the increase in pitch by using frequency. However it seems that java isn't able to handle it as it doesn't increase the pitch and indeed locks up for a few seconds as the beeps start overlapping each other.