halvves / webmonome

we've moved to sourcehut! this is just a mirror of: https://sr.ht/~merl/webmonome/
https://www.npmjs.com/package/webmonome/v/alpha
MIT License
11 stars 1 forks source link

Compatibility with 2008 Monome 64? #1

Closed domchristie closed 2 years ago

domchristie commented 3 years ago

Thanks so much for creating this! I'm so glad it exists :) I have a reasonably old Monome 64 (bought ~2008). I have been trying to get webmonome working, but am having some issues, and wondered if you had any ideas?

Connecting the device works, but when pressing keys, it throws RangeError: Offset is outside the bounds of the DataView on https://github.com/halvves/webmonome/blob/55c544c77f1729391c1a98d696fe6a9f971e40a2/src/webmonome.js#L163 because start is 5, whereas the data view only has a byle length of 4. And possibly related, when pressing a key, the header is matching a query in the switch/case, whereas I'm wondering if that should match the keydown header value instead?

Programmatically setting LEDs also didn't work, so I'm wondering if it's an issue with it being a Monome 64 vs a 128? (The nodejs grid studies code with serialosc seems to work as expected.)

Let me know if you need more info, and thanks again!

halvves commented 2 years ago

Oh woah! So cool that someone else finds this interesting (and maybe even valuable?). I'm so sorry that I missed this issue. I believe there were some changes over the years with the monome protocol. libmonome does some elegant handling of which protocol (mext, series, etc...) to use based on which model of monome is detected. I definitely want to implement something similar in webmonome eventually (sometimes I don't wonder if just compiling libmonome to wasm and simply writing a gluecode library would be better, but I kinda like the idea of no compilation browser native js).

When I make some time I will definitely try to add some of this handling of variant protocols and different grid sizes and try to do some testing with you. I also have an old monome kit (mk) that I'd like to start using for testing of different models as well. Right now I've just been testing on the standard/modern 128. Also... if you feel comfortable poking at the codebase, you are more than welcome to tinker around and issue a PR as well!

domchristie commented 2 years ago

Thanks for getting back! Yeh, I like the idea of a browser-native library. Enabling monome-based browser control could be 🤯 (e.g. a browser-based MLR could record & share audio over WebSockets/WebRTC)

webmonome feels so close to working on my 64, I think I just need to work out the mapping of headers/data to operations. This stuff is a bit more low-level than I'm used to, but I might give it a go! What did you use as a reference to figure out how it currently maps? i.e. the switch statement here: https://github.com/halvves/webmonome/blob/55c544c77f1729391c1a98d696fe6a9f971e40a2/src/webmonome.js#L159

Thanks again!

halvves commented 2 years ago

@domchristie Our heads are definitely in the same place w/r/t to WebSockets, realtime browser apis, etc!

This was my primary reference for the monome protocol: serial.txt, but I have a feeling we are going to need to dig into libmonome some for the alt/older protocols.

domchristie commented 2 years ago

Thanks! (I can't believe I didn't scroll down on serial.txt to see all the protocol stuff 🤦‍♂️) If I make any progress I'll let you know

domchristie commented 2 years ago

I have made a start on this here: https://github.com/domchristie/webmonome/tree/series

domchristie commented 2 years ago

It's turned into a big-ish refactor as I've created separate classes for the mext and series protocols. As such, it now just exports a single async connect function, which decides which class to instantiate based on the device serial number. I've implemented button presses, single LEDs, all LEDs, and intensity (no row/column stuff yet). The series protocol should also support Monome Kits.

halvves commented 2 years ago

Closing this issue for now since you added almost full support in #2. We can do some follow up PRs to add the rest of the functionality.