Sonic Pi for video games question


I’d like to use Sonic Pi to create music for a video game.The idea is to have events in the video game trigger events in Sonic Pi. Example: every time a player in the game jumps, a sample in sonic pi will play. Or if the game becomes more intense, then some code in Sonic Pi would be triggered and the music would speed up.

Is this possible to do? A game developer has asked me if Sonic Pi can run in the background of their game and if you can trigger Sonic Pi code with specific events that happen in the game.

This game is written using Javascript. Is it possible to have javascript control Sonic Pi? And if so how?

And can sonic pi be built into a video game?



Hi Leo
It should be possible to make progress with this. I have done several projects where external input is sent to Sonic Pi to trigger sounds. It is fairly easy to do using OSC messages. I have not used javascript much but a quick google shows that there are OSC libraries available.
It is also possible to run Sonic Pi in the background see Sonic Pi for standalone installations
However it will use quite a lot of resources, so you may find if you add a game on top that it is not ideal on a Raspberry Pi.

1 Like