Two question about handling patches in raspberry pi

plem's icon

Great to mess around with RNBO and raspberry. And it leads to these two questions:

Can I control which patch to load with OSC, so I can control that from within the raspberry? I can do it with rnbo.remote of cause from my laptop, but how when there is no laptop around?
Can I remove patches from the pi, with rnbo.remote or OSC?

thanks to you all,
Peter

Jan M's icon

I believe there is an OSC endpoint for this. If you open in a browser http:/</raspi host name or IP>:5678 you get a json file with all the definitions.

Alex Norman's icon

the latest release, 1.2.1, does not have a way to delete patches but we have a 1.2.2 release candidate in the works that has that ability exposed, "patcherdestroy" in [rnbo.remote] but also via OSC.

I need to get better about publishing documentation of the OSC interface, but for now.. here is an example.. my PI is at c74bull32.local

the control interface can be inspected here: http://c74bull32.local:5678/rnbo/inst/control

{
  "FULL_PATH": "/rnbo/inst/control",
  "CONTENTS": {
    "unload": {
      "FULL_PATH": "/rnbo/inst/control/unload",
      "TYPE": "i",
      "VALUE": -1,
      "ACCESS": 2,
      "CLIPMODE": "none",
      "DESCRIPTION": "Unload a running instance by index, negative will unload all"
    },
    "load": {
      "FULL_PATH": "/rnbo/inst/control/load",
      "TYPE": "is",
      "VALUE": [
        0,
        "FeedbackSynth"
      ],
      "ACCESS": 2,
      "CLIPMODE": "none",
      "EXTENDED_TYPE": "list",
      "DESCRIPTION": "Load a pre-built patcher by name into the given index args: index patcher_name [instance_name]"
    },
    "sets": {
      "FULL_PATH": "/rnbo/inst/control/sets",
      "CONTENTS": {
        "save": {
          "FULL_PATH": "/rnbo/inst/control/sets/save",
          "TYPE": "s",
          "VALUE": "",
          "ACCESS": 2,
          "CLIPMODE": "none",
          "DESCRIPTION": "Save a set of instances assigning the given name"
        },
        "load": {
          "FULL_PATH": "/rnbo/inst/control/sets/load",
          "TYPE": "s",
          "VALUE": "",
          "RANGE": null,
          "ACCESS": 2,
          "CLIPMODE": "both",
          "DESCRIPTION": "Load a set with the given name"
        }
      }
    }
  }
}
Alex Norman's icon

I can inspect my pi (at c74bull32.local)'s patcher interface can be inspected here (I have a few patchers on the PI already, and the destroy endpoint might not be there until 1.2.2): http://c74bull32.local:5678/rnbo/patchers

{
  "FULL_PATH": "/rnbo/patchers",
  "DESCRIPTION": "patcher descriptions",
  "CONTENTS": {
    "BufferPlayer": {
      "FULL_PATH": "/rnbo/patchers/BufferPlayer",
      "CONTENTS": {
        "io": {
          "FULL_PATH": "/rnbo/patchers/BufferPlayer/io",
          "TYPE": "iiii",
          "VALUE": [
            0,
            2,
            1,
            0
          ],
          "ACCESS": 1,
          "CLIPMODE": "none",
          "EXTENDED_TYPE": "list",
          "DESCRIPTION": "input and output counts: audio ins, audio outs, midi ins, midi outs"
        },
        "created_at": {
          "FULL_PATH": "/rnbo/patchers/BufferPlayer/created_at",
          "TYPE": "s",
          "VALUE": "2023-10-23 22:58:16",
          "ACCESS": 1,
          "CLIPMODE": "none"
        },
        "destroy": {
          "FULL_PATH": "/rnbo/patchers/BufferPlayer/destroy",
          "TYPE": "I",
          "VALUE": null,
          "ACCESS": 2,
          "CLIPMODE": "none",
          "DESCRIPTION": "delete this patcher"
        }
      }
    },
    "FeedbackSynth": {
      "FULL_PATH": "/rnbo/patchers/FeedbackSynth",
      "CONTENTS": {
        "io": {
          "FULL_PATH": "/rnbo/patchers/FeedbackSynth/io",
          "TYPE": "iiii",
          "VALUE": [
            0,
            2,
            1,
            0
          ],
          "ACCESS": 1,
          "CLIPMODE": "none",
          "EXTENDED_TYPE": "list",
          "DESCRIPTION": "input and output counts: audio ins, audio outs, midi ins, midi outs"
        },
        "created_at": {
          "FULL_PATH": "/rnbo/patchers/FeedbackSynth/created_at",
          "TYPE": "s",
          "VALUE": "2023-10-23 22:57:56",
          "ACCESS": 1,
          "CLIPMODE": "none"
        },
        "destroy": {
          "FULL_PATH": "/rnbo/patchers/FeedbackSynth/destroy",
          "TYPE": "I",
          "VALUE": null,
          "ACCESS": 2,
          "CLIPMODE": "none",
          "DESCRIPTION": "delete this patcher"
        }
      }
    },
    "FreqCycle": {
      "FULL_PATH": "/rnbo/patchers/FreqCycle",
      "CONTENTS": {
        "io": {
          "FULL_PATH": "/rnbo/patchers/FreqCycle/io",
          "TYPE": "iiii",
          "VALUE": [
            0,
            1,
            0,
            0
          ],
          "ACCESS": 1,
          "CLIPMODE": "none",
          "EXTENDED_TYPE": "list",
          "DESCRIPTION": "input and output counts: audio ins, audio outs, midi ins, midi outs"
        },
        "created_at": {
          "FULL_PATH": "/rnbo/patchers/FreqCycle/created_at",
          "TYPE": "s",
          "VALUE": "2023-10-23 22:59:14",
          "ACCESS": 1,
          "CLIPMODE": "none"
        },
        "destroy": {
          "FULL_PATH": "/rnbo/patchers/FreqCycle/destroy",
          "TYPE": "I",
          "VALUE": null,
          "ACCESS": 2,
          "CLIPMODE": "none",
          "DESCRIPTION": "delete this patcher"
        }
      }
    }
  }
}
Alex Norman's icon

so to load a patcher, BufferPlayer, you send an OSC message: /rnbo/inst/control/load 0 BufferPlayer
and to destroy a patcher, FreqCycle, you'll send: /rnbo/patchers/FreqCycle/destroy

Jan M's icon

Just to avoid some frustrations ;)

The Python code John Smith posted seems to be based on the Python library pyliblo3.

It is a good an fast library as it is basically just a Python wrapper around another library written in C (liblo-dev).
However the Python version doesn't install anymore on recent Python versions (It broke somewhere in the course of last year unfortunately).

There is a hack to get it to work that I posted in this thread: https://cycling74.com/forums/pyliblo3-wheel-error-on-raspberry-pi-install
The trick is basically to force Python to use an older version of its C wrapping tools. I did not test in depth if this could create problems with other external Python libs.

In the same thread I also mention another Python OSC library I tested, named pythonosc (https://python-osc.readthedocs.io/en/latest/). This one is a pure Python implementation of OSC and works well, but as it it pure Python it is also very slow and CPU hungry. For just occasional OSC calls it is fine. The syntax is a little less straight forward but still quite good.


Andrew Pask's icon

John Smith was a bot - sorry about that folks

-A

Jan M's icon

A quite creative bot except for choosing its name 😂

I guess this means they are definitely not yet self aware 😂😂😂

plem's icon

Thanks, Alex. I have it on the road!
Only thing: I had to use the port 1234.

Alex Norman's icon

ahh yeah, the UDP port is 1234, good to note!