Create ToneGenerator

disclaimer: this particular function was not authored by me and I claim no ownership of it as such.