OSCQuery, PythonOSC - get preset and patcher names from RNBO to python on Pi
Hi . .
I have a RPI synth project I've been working on for a while. I can send knob and button data to the currently loaded RNBO patch on a RPI via a python script that runs in the background. I'm using the PythonOSC library to convert the GPIO info from the Pi to OSC messages that are sent to the RNBO parameters. It works well. However, everything I'm doing in Python is one direction - sending OSC messages to RNBO. I'm now trying to sort the other direction. Retrieving info from RNBO to Python.
Now that we can load more than one RNBO patch at a time onto the Pi, I would like to:
- retrieve the list of patcher names that could potentially be loaded
- retrieve the corresponding preset names for the currently loaded patcher
My synth has an LCD that displays the parameter names and values as they change. The goal is to boot the Pi and have the LCD display a menu with the patcher options, load a patch, and display the possible preset names.
soooo (of course!) is there a simple way to do this via RNBO that I am most likely missing? I've read through many RNBO threads that seem related. I can do this via the web interface, and rnbo remote but I would like to get this data into Python. I've looked at OSCQuery and know where in the file to find the proper bits. For example the preset names:
"entries":
{"FULL_PATH":"/rnbo/inst/0/presets/entries","TYPE":"ssss","VALUE":["Droney","Parrots","Pulse","Rhythm"],"ACCESS":1,"CLIPMODE":"none","EXTENDED_TYPE":"list","DESCRIPTION":"A list of presets that can be loaded"}
My thought is this info probably lives in a json file somewhere. If so, where? I could potentially parse the json file using Python to get this data. Would that make sense or is there a better way to retrieve the data?
Or in Python could I directly access the OSCQuery db info somehow?
I really hope I'm missing something simple. And I imagine this might be more of a Python thing but knowing the best way to parse the RNBO OSCQuery info from the start would be helpful. Maybe someone has already done this and has a few thoughts to share. Thanks!
There isn't a file that exists on disc anywhere, the JSON you see is simply a representation of the HTTP/OSC interface is built out programmatically and changes dynamically based on various things like parameter updates, new patchers, etc etc.
You can get the list of patchers with an HTTP get from a script: http://<yourrpihostname>:5678/rnbo/patchers
You can also open a websocket and get updates that indicate when those entries change, or you could setup a UDP OSC listener for the same information.