See eg:
(There are changes to the Sonic Pi API that will require several changes to the plugin code, but you get the idea).