EDIT in response to a query on youTube about the video for this project, I have added an alternative Sonic Pi program which allows you to choose the synth to be used using the number keys. use SP-KeyboardController3.rb
instead of SP-KeyboardController2.rb with the terminal program terminalcontroller2.rb
You use the number keys to select the required synth.
The code gist is here
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