Is it possible to use Sonic Pi as a performing instrument

Is there some simple way to use Sonic Pi as an instrument and not only as a composition tool? I.e I would like the students to program their own sounds and/or patterns and launch them using the keyboard’s keys.

In a sense: yes, that is called “live coding”.

You can “program sounds and/or patterns and launch them using the keyboard keys”,

but not (or at least not easy / by default) in the sense that “when I press ‘A’ a little melody or drum sound is played”,

you can write your code/music in live loops, and edit and re-evaluate it on the fly, without stopping, so in this sense Sonic Pi can be played as an instrument, but not like a keyboard where you have a direct mapping between keys and sounds.

Live coding is introduced at the very beginning of the built-in tutorial : “1.1. Live Coding”.

Sonic pi does support midi now:

http://sonic-pi.net/tutorial.html#section-11

The inability to easily do keybinds as you mention is something I consider a downside of sonic pi.

Agreed - this would be lovely to have. If you are in a position to contribute this feature that would be amazing. Alternatively please do consider supporting Sonic Pi’s ongoing development financially so that I can continue to work on features like this going forward: https://patreon.com/samaaron

What is technically difficult about it? Does the interface expose the ability to hook the event loop? If so it should just be a matter of sending messages to the back end. From what I understand there is a background server running, and you send the code from the editor to this.

Time, effort and the design work required to ensure that it is simple enough for a 10 year old child.

Technical difficulty is rarely a barrier for a new feature :slight_smile:

1 Like

It would require a modal interface to differentiate between typing into the editor, and playing notes with a keybind.

Understood - we even had a prototype of this.

As I mentioned before, the technical parts are rarely the main issue. It’s the time to simplify and polish.

Again, please let me recommend that you watch this wonderful talk which discusses the wider issues of maintaining open source software systems and the ways we should engage as a community:

1 Like

I developed an interface using TouchOSC to use Sonic Pi as an instrument. It used the same layout as the Ableton Push2 interface which makes it very easy to play. It allowed for changes in key synth decay envelop and let you record and playback sequences. When playing back the keyboard is still live so you can accompany yourself and record the combined outputs using the built in SP record button.
I published an article about it here: