Reading from a databases

Hello. I was wondering if it is possible to read from a database from within sonic pi code? Thanks.

Hello @rholden :slight_smile:

As you may imagine, there are no commands in the Sonic Pi language itself designed for doing this. Since Sonic Pi’s language is essentially built on top of Ruby, it is possible that you may be able to use some Ruby code to do what you are after. (There is no guarantee that such a thing would work however).

1 Like

see this previous post


…thanks :+1:

hi @rholden

Just curious : what is your plan ? Which database technology do you want to use ?

I want to develop some sort of simulation (for example, some Braitenberg ‘vehicles’) and have their variables affect Sonic Pi behaviour. I was thinking of writing the states to a DB (probably sqlite) and have Sonic Pi read them. I looked at the OSC stuff though… I will probably write the variables into the osc array etc. Cheers, R.

ok cool ! json is maybe a way to explore. Sainte_json a synth working with external json file