Static ports for serialosc.maxpat

  • I'm trying to get serialosc-based Max applications working in [[|Wine]], a Windows compatibility layer for Linux. Right now I'm stuck because of the complications between the Bonjour zeroconf stack (running in Wine, which actually doesn't run it correctly) and the native Linux zeroconf stack, Avahi. Long story short, I need to remove all the Bonjour/zeroconf port lookup/resolve commands from serialosc.maxpat, in favor of assigning a specific port to talk/listen on.

    On Linux, we already have to specify our server and application ports in serialosc's config file. So since this is "static" and never changes, there's no point in having anything like Bonjour running to guess ports and resolve them. I'm looking for a way to just shove the known port numbers at each Max app. So I need help modifying serialosc.maxpat, since it specifies a random port.

    Hopefully this will let Max apps talk directly to the same ports serialosc and Avahi are already using.

    (I'm aware that there's a Max5 converter utility to open Max patches in in PureData, but I can't get it to work. I can open serialosc.maxpat and edit it as a plaintext file only; I don't see anything graphical on Linux, so please keep that in mind. Line numbers are our friends!)

  • Nope, still no luck. Editing Max patches was made to be done visually, which I just can't do on Linux. It's much, much harder to hunt through the line numbers and find which obj-id goes to which box and line.

    At least I can still use older patches with monomeserial, but I'm going to be left behind once everything is converted to serialosc. And of course, nothing new and interesting, like grainstorm, is coded for monomeserial.

  • this is a static replacement. you set the port number as the first argument to the bpatcher

    nothing fancy, however, just a couple udp objects. let me know if it works.

  • Thanks, tehn. Now, since I don't see the graphical stuff that you do, and I don't know what a bpatcher is, which lines in the file am I looking for? It's plaintext, so any text editor should work to get us on the same page; I use vim.

    Line 92 has this: "text" : "udpsend localhost 17812" -- should I change this number to match my port?

  • change all of the #1 to the port you want to use.

  • Thanks for your patience & help; my networking knowledge sucks. Now, just so I understand which port number that I put into #1, is this the server port number from ~/.config/serialosc/, or is it the application port number?

    Here's my m128-000.conf:

    server {
    port = 15924
    application {
    osc_prefix = "/arpshift"
    host = ""
    port = 9001

    I've tried a few combinations of those port numbers in the file, but I keep getting messages about serialosc or the patch unable to bind to the port because it's already in use. Whichever launches second usually loses, though I will say that for a moment, I got the monome mostly to light up the way it's supposed to when arpshift starts. Couldn't manipulate it, but it did display most of the right group lights.

    Update: I'm trying mabalhabla, and I can use the in-app draw tool to turn on and off the lights. But I still can't press anything on the monome to send data; the Max window tells me "binding to port 15924 unsuccessful" because there's already something running on it: serialosc.

    If I start mabalhabla first, then serialosc can't connect: "lo server error 9904 in (null): cannot find free port"

    The draw/send LED tool works when I have "udpsend localhost 15924" specified in the file, rather than the default "17xxx" or whatever it was, even though you didn't mention editing it. I started serialosc first, then mabalhabla, and it still gives me the message about the unsuccessful binding, but at least I can send messages to the monome. Now I just gotta figure out how to send data from the monome to the app.

  • the max port is the application port. in this case, bind mabalhabla to 9001.

  • Got it working!

    As @tehn instructed, I replaced every instance of "#1" with "15924" but this wasn't enough. At the bottom of the file, I noticed a couple of lines: "udpreceive XXXXX" (line 78) and "udpsend localhost XXXXX" (line 92). I changed the "udpreceive" port to "9001" based on @visinin's post, and "udpsend localhost XXXXX" to "udpsend localhost 15924".

    But rather than go back and change all the "#1" entries to "9001", which already had "15924" in them, I decided to leave it as-is and start up mabalhabla. Success! It makes noise when it should, and the buttons light up when I press 'em.

    Now I got to get the edited serialosc.maxpat and new instructions up on my wiki article.

    Thanks for the assist, @tehn and @visinin!

  • @tehn, can you please fix static-serialosc.maxpat so that it:

    - allows to manually enter the static server port number (where serialosc/griddle is listening) and
    - either selects a random free application port for itself (preferred) or allows to enter it by hand.
    - sends its application host/port to serialosc/griddle via /sys/* messages (support for other /sys/* messages would be also great).

    the only difference with a zeroconf version would be the initial server port selection (i think), so it is probably not that hard to implement?

    this functionality would make things so much easier for us, linux users. thanks!

  • This would, indeed, be real nice!

  • can you guys explain why this would be helpful with a use case?

  • @tehn:

    makes it easier to:

    1. run more than one max application simultaneously
    2. change monomes, add monomes, etc.
    3. use middleware/layers like pages or griddle, which need easily changed ports. especially when running multiple max applications that need "static" ports.

    when any of these happens, it requires a lot of backtracking through maxpats to manually edit and re-edit all those ports. the networking stuff is working correctly, except for discovery. we can do that part manually. apps should be able to handle the rest.

  • months old!

    i'm revisiting the serialosc.maxpat and need suggestions. which requests have remained integral and necessary?