Reading and manipulating Score parameters from Max

Hi all, I’m wondering if someone could share a Max patch that demonstrate how to read and manipulate Score’s internal parameters. There are two concrete things I’m interested in doing right now:

-Using a number box in Max to remotely control the speed of a given interval.
-Reading the boolean value of Score’s play state (/score/play, I believe) in Max and using it to control something else.

From the Add device menu in Score, I can see that Score is available as an OSCQuery device (at ws://[myMachine].local.:9999 by default), but I’m not quite sure how to read or write values from here in Max. I tried looking at the Ossia overview patcher - specifically at the example on getting an OSCQuery-formatted namespace as a dictionary - but Max reports that the maxurl object doesn’t support WebSocket addresses ("maxurl: Protocol “ws” not supported or disabled in libcurl). Any help is greatly appreciated!

Try that : https://github.com/OSSIA/score/blob/master/Documentation/Examples/Max/score-client.maxpat

Warning : WIP + might be crashy but at least it shows the principles

It should be less crashy as of my last commit if anyone can try

Also, to see which values are available to read / write, add the “Local” device in score (it’s the special device that exposes score’s parameters to oscquery) ; you can also check http://127.0.0.1:9999 in a web browser (preferably firefox, it shows json prettily)

Thanks bltzr and jcelerier! I tried the patch out, and it’s all working fine over here.

Actually, I see that Max crashes if Score is open and I send the “connect oscquery ws://127.0.0.1:9999” message to ossia.client more than once.

ossiacrash

Testing with ossia-max 1.0.0, Score 2.0.0-a4, Max 7.3.5, OS X 10.11.6.

Let me know if you want the crash report - it’s too big to paste and you can’t attach txt files here, but I can email it or put it in the Gitter.

Sorry about that crash Evan. This is already logged here: https://github.com/OSSIA/libossia/issues/389

Oops, missed it - thanks @jln!

Another thing - when I open a patch that has an [ossia.remote running] object (which I’d like to use to monitor Score’s transport state) as well as an [ossia.client score], after a certain delay I get the following error message in the Max window:

ossia.client: oscquery_mirror_protocol::oscquery_mirror_protocol: Could not connect to ws://127.0.0.1:5678

This happens even when a “connect oscquery ws://127.0.0.1:9999” message has been sent to the ossia.client via a loadbang. Once this error message appears, the [ossia.remote running] no longer reports accurate values.

Here’s the patch:


----------begin_max5_patcher----------
427.3ocwTEtSCBCD92vSQS+MhTX.Y6UwrX5fKZWfVrsL2hw2cKWAiywxlQWj
DJ495w8ce2csuEFP2n1CFJYE4ARPvagAAHz.Pvnc.skuupgaP2nsfwveBnQ9
8rvdKhmLgHpQa0ls2sbBS12p5sMfEiAaD0CYOzA9DfRIqG2xXOzfnzuDBgbJ
Boifcba0yB4SOpgJqOHr73jHBq.+jmLrllFmPVO7GuGFNrDckZUBu5jwIRUY
LBdrFZUVfn6kRWFLi5KmW8YmU8QiuWaUfcwpPZh+S1snLzn30a3yJ8heXiGC
yemrw0heWu+by4UJozwGQYpdoGzGHuZVc+8rzxXGewrUKcOyTQx92NJr.WSY
Y2tiBUMBPZIlJkFlQ6rak1u3jPoedHYdsizPaDxueCHFuA7iKHFUutZJIGOg
SXelr0fwJjbqPI+hOKOxmVQcmRHsiDVVDmOLuh4Wd9mFmoEcs4k63GI4B4Ul
2meEOYWAOrS3wW14cc6.sYzYjB2D2VkdvrLBMERuIdkIUC6DS9miHbsqsac8
7dseJYewBp+WU0fV1KvojvAleO7C8hHlJA
-----------end_max5_patcher-----------

I know this is an open issue, but in the meantime is there any other way to send Score’s transport state to Max, e.g. to establish a direct OSC connection?

Edit: just tried with the latest release from the repo (1.0.0-b19), and now Max spontaneously crashes a few seconds after connecting to Score. Brief notes from the crash report:

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000000000138a
Exception Note: EXC_CORPSE_NOTIFY

I think there’s something wrong with the (automatic) name-based connection (it it’s confirmed, then I guess it should be reported)

so, could you try giving another (or no) name (ie argument) to ossia.client than “score” ?
And see if that helps

I just tried and it seemed to work fine

ossia.client with no argument seems to work here too - thanks! Perhaps score-client.maxpat should be updated accordingly, at least until the underlying name-based connection issue you mention is sorted.

@jcelerier does local device only interact with OSCquery? can I also send plain old OSC to it? say controlling the play state from qlab? what would I put in websocket for that?

You have to create an osc device for that : choose osc instead of osc query when creating a new device

Does that help?

no I meant local device to control play and stop etc in score…

Ah OK, sorry I misread your message.

I think @jln did that from max. AFAIK you just have to send plain osc messages to score’s osc port.

I tried the other day (not very hard) and I was not so successful, but I think I missed some things for that…

But yes at least for play and stop it works quite easily
/play 0 or 1
Just /stop (without value)

OSCQuery is a superset of “plain old OSC”. Every OSCQuery device is also an OSC device.