Hi,
The real name is Open-Stage-Control O-S-C
this is a little example to trigger the play of a scale. Parameters comes from O-S-C.
# Sonic Pi meets Open-Stage-Control
# By nlb - 20-06-2020
# sonic pi version : 3.2.2
# open-stage-control : 1 beta 7 (https://openstagecontrol.ammd.net/download/ Bravo To Jean-Emmanuel)
# external midi virtual instrument : UVI Workstation
# loopMIDI https://www.tobias-erichsen.de/software/loopmidi.html
# OS : Windows 10
use_bpm 60
live_loop :scaleTriggeredViaOpenStageControl do
# use_real_time
data = sync "/osc:127.0.0.1:7777/scale" # note no / at the end
##| puts data[0] root note passed via open-stage-control
##| puts data[1] scale name
##| play data[2] number of octaves
##| data[3]==1 # button pushed
if (data[3]==1) then # button pushed
tick_reset_all
riff = scale data[0], data[1], num_octaves: data[2]
puts riff
riff.length.times do
midi riff.tick('n'), port: 'loopmidi01', channel:1
sleep 1
end
end
end
# to check if the external virtual midi device is playing notes received from sonic pi
live_loop :bass, auto_cue: false do
stop
midi [60, 72].tick-12, channel: 1, port: 'loopmidi01'
sleep 1
end
and the json file to load into O-S-C
{
"session": {
"type": "root",
"id": "root",
"interaction": true,
"colorBg": "auto",
"colorText": "auto",
"colorWidget": "auto",
"alphaFillOn": "auto",
"padding": "auto",
"css": "",
"variables": "@{parent.variables}",
"traversing": false,
"layout": "default",
"justify": "start",
"gridTemplate": "",
"scroll": true,
"innerPadding": true,
"verticalTabs": false,
"value": "",
"default": "",
"linkId": "",
"script": "",
"address": "/msg",
"preArgs": [
5,
3
],
"typeTags": "",
"decimals": 2,
"target": "",
"ignoreDefaults": false,
"bypass": false,
"widgets": [
{
"type": "button",
"top": 280,
"left": 30,
"id": "button_2",
"visible": true,
"interaction": true,
"width": 170,
"height": 70,
"expand": "false",
"colorBg": "auto",
"colorText": "auto",
"colorWidget": "auto",
"colorStroke": "auto",
"colorFill": "auto",
"alphaStroke": "auto",
"alphaFillOff": "auto",
"alphaFillOn": "auto",
"padding": "auto",
"css": "",
"label": "c3 major 2 octaves",
"on": 1,
"off": 0,
"mode": "push",
"doubleTap": false,
"colorTextOn": "auto",
"value": "",
"default": "",
"linkId": "",
"script": "",
"address": "/scale",
"preArgs": [
"c3",
"major",
2
],
"typeTags": "ssii",
"decimals": 0,
"target": [
"127.0.0.1:4560",
"127.0.0.1:8888"
],
"ignoreDefaults": false,
"bypass": false
},
{
"type": "button",
"top": 380,
"left": 30,
"id": "button_3",
"visible": true,
"interaction": true,
"width": 170,
"height": 60,
"expand": "false",
"colorBg": "auto",
"colorText": "auto",
"colorWidget": "auto",
"colorStroke": "auto",
"colorFill": "auto",
"alphaStroke": "auto",
"alphaFillOff": "auto",
"alphaFillOn": "auto",
"padding": "auto",
"css": "",
"label": "c2 minor 4 octaves",
"on": 1,
"off": 0,
"mode": "push",
"doubleTap": false,
"colorTextOn": "auto",
"value": "",
"default": "",
"linkId": "",
"script": "",
"address": "/scale",
"preArgs": [
"c2",
"minor",
4
],
"typeTags": "ssii",
"decimals": 0,
"target": [
"127.0.0.1:4560",
"127.0.0.1:8888"
],
"ignoreDefaults": false,
"bypass": false
}
],
"tabs": []
},
"version": "1.0.0-beta7",
"type": "Open Stage Control session"
}
Hope it helps to catch some syntax tips to begin with O-S-C