Is there a limit on midi_send() calls? | Intech Studio
💬 general Grid

Is there a limit on midi_send() calls?

robamboule · · 6 replies

I'm trying to implement the following code but am having a problem, seemingly with the amount of midi_send() parts, or maybe I'm doing something weird... I'm new to Lua and just using the action blocks and converting those to code to see what they do...

This seems to work:

self:element_index(),
self:button_value(),
(module_position_y() * 4 + page_current()) % 16,
(32 + module_position_x() * 16 + self:element_index()) % 128

self:button_mode(0)

for i = 1, 6 do
midi_send(i - 1, 176, 49, 127)
midi_send(i - 1, 176, 7, 108)
end

midi_send(6, 176, 49, 0)
midi_send(6, 176, 7, 108)```
However, when I try to add the following code to the end of this it doesn't work suddenly and no MIDI messages are sent at all:
```midi_send(7, 176, 49, 0)
midi_send(7, 176, 7, 108)```
Why is that?

Replies (6)

Greg-Orca Greg-Orca ·

Hi,
I tried it and it’s sending out the MIDI messages correctly. Are you using the latest firmware version 1.3.5?

You could try adding a slight delay using Timer Start, and place the last two MIDI messages there

robamboule ·

Thanks for coming back to me on this one! Yes, I'm on the latest firmware and the latest version of the Grid Editor... I really am losing my mind on this one, as it just doesn't want to do it 😆

robamboule ·

I've gone back to "first principles" and put the actions together in the sceenshot and that works. However, as soon as I add the 2nd midi_send() into the 2nd loop. It stops sending out any MIDI messages when I press the button... Weird.

Screenshot_2025-05-23_at_07.58.42.png
narayb narayb ·

There is some kind of rate where you're sending out too many messages. If I recall correctly, sending out 16 or more at the time form one event was close to that limit.

narayb narayb ·

Yours is 14 (?) messages on a Press and then again on a Release, probably close together.

narayb narayb ·

Might be too much. What you could do is to load them into a buffer and space them out with like a 10ms timer and see if that helps.

Discord

View on Discord

This post is from the Intech Studio Discord community.

Open thread →