How does the grid editor identify the source device of a MIDI message? | Intech Studio
💬 general Grid

How does the grid editor identify the source device of a MIDI message?

foxxx
foxxx · · 15 replies

When you have (for example) a PBF4 and a VSN1 connected, the grid editor shows the origin of a "note on" MIDI message when pressing a button on one device vs the other. Is this because it's receiving via serial rather than actual MIDI? And if so, where can I find the details of the serial protocol?

What I'm trying to do is that I want button 1 on PBF4 to always map to the same action, no matter the layout of the grid devices. While I appreciate the way the MIDI event codes are dynamically calculated depending on the grid X/Y layout, for my use case I want them to be consistent no matter the layout.

So I could either detect which device is sending the message and use that for segmenting, or modify the default MIDI sending to somehow ignore the layout (I don't want to manually set up a unique event code for every element in grid editor).

Does anyone have good ideas on how best to achieve this?

Replies (15)

kkerti kkerti ·

I did not dive fully into the current implementation of Editor's midi monitor, but it has two separate parts: one true midi monitor, which checks midi through MIDI port and the other one is debug midi, which is parsed from the serial data coming to Editor from the hardware. There the data has the x-y coordinate among other details.

To see the x-y coordinates, flick over the toggle top right on midi monitor.

kkerti kkerti ·

Do you want your PBF4 units to send the same data no matter their positioning?
To some extent, you will have to go over all elements manually once to change them.

For example this example on the image fixes channel ch and calculates num from the element index. You could add a multiplication to the num or ch based on module position X / Y or an arbitrary number as a global variable to avoid clashing with multiple MIDI controllers and their midi values.

image.png
foxxx foxxx ·

Ah yeah, so maybe I can just connect to the device via webserial and use the serial messages instead, like the editor does?

I admit my use case is a little odd - but I don't really want to configure the device via the UI, just programmatically as much as possible. It's for a webapp where I'd like people to be able to purchase the grid hardware modules and use them with it out of the box, without needing to configure them first.

Do you know if the serial protocol is published anywhere?

kkerti kkerti ·

If you feel more comfortable that way, yes, but you would have to do immerse amount of legwork in my opinion.

foxxx foxxx ·

I'm ok with that - I'm the author of the loupedeck NPM package and had to reverse engineer its serial protocol. But it would be nice if the Grid serial protocol had some docs that could be shared?

kkerti kkerti ·

There are no special docs other than the reference / wiki pages of the docs.intech.studio.

kkerti kkerti ·

These are the protocols descriptors used in Editor.

kkerti kkerti ·

https://github.com/intechstudio/grid-editor/blob/stable/src/renderer/runtime/runtime.ts
this is the runtime in editor which does quite some heavy lifting in parsing and using the data from pthe hardware

kkerti kkerti ·

And there is the message stream file which might be interesting for you, where the data coming from hardware is used in the editor.

https://github.com/intechstudio/grid-editor/tree/stable/src/renderer/serialport

foxxx foxxx ·

that's super useful! I had not actually read any of the grid editor repo code yet, this helps a lot to narrow it down 😁

kkerti kkerti ·

I am not knowledgeable enough in the firmware part though, but grid-fw repo is your option there.

kkerti kkerti ·

Although our code could be better as this is our first hefty code base and has some skeletons in there, I think with the help of Claude / Gemini or other llm, you should be able to get a general understanding in how things work.

foxxx foxxx ·

No codebase is immune from skeletons, that's just the nature of software 🙂

foxxx foxxx ·

Really appreciate your time on answering my questions, thank you!

Discord

View on Discord

This post is from the Intech Studio Discord community.

Open thread →