I am not 100% what you are going for, but I have a "Tone" library someone wrote and open sourced for generating frequencies and is non-blocking. I had to make some corrections to the library and added support for the mega 2560, but that portion of the library is now proprietary with my company and I cannot share the corrections I made, however I think I might be able to dig up the library files from the net, or I can look on my work computer, come Monday morning.