Previously in April 2016 I published some code which enabled a computer keyboard to provide note input to Sonic Pi. At that time, Sonic Pi did not externally support OSC messages, and I opted to use a tcp/ip link, which had certain shortcomings in respect to speed, and error messages when the link was not created in the proper manner. Recently another thread has referenced this code, and that spurred me on to revisit the code and to update it to use OSC messaging, now supported for input by Sonic Pi 3.1 The result was an easier interface to set up, and one which turned out to be much more responsive.
The link above goes to an article listing the code, and also shows a truncated video of teh system in action. A fuller video is available on you tube here