Tap tempo that gradually morphs to song tempo — doable?

Is it theoretically possible (via scripting) to create a tap-tempo widget that, once you start the metronome, smoothly transitions over a preset number of bars to the target tempo the song should be played at?