Sending Sysex in MIDI Remote API

Hi everyone

I’m totally confused. I am trying to send a sysex message to my control surface using the API.
Apparently I can only send it via the sendSysexFile method (note that sendMidi is not applicable because the timing is too fast and the message gets corrupted…)
But the messages I need to send are not constant: I cannot use pre-saved files.
I am assuming I am missing something, as I don’t see why we should have to use external files (especially in a js project!).
Anyone there to enlighten me ?
Thanks !!

Hi,

You should use the sendMidi() method.

You can slow down the rate that sendMIDI sends by splitting the SysEx array into arrays and applying a delay between each? Wrap it into it’s own JS function and set the delay (ms) as a parameter to aid debugging it.

Knowing how your device prefers the data to be sent is of course the most important factor in this.

Be careful testing with the debug window open though, as that can cause the MIDI Remote to run a little slower than normal.

note that sendMidi is not applicable because the timing is too fast and the message gets corrupted

Enlighten us and tell us how that sysex looks or what this sysex should provide.
Martin is not wrong with his statement, i have seen it with my own eyes, that this works all the time, even on really timebased things like VU-meters. It should not be a problem.

Hi,

As JS is single-thread, this would make the whole Remote thread frozen. Or am I wrong?

Single thread, but can be asynchronous too. I’ve not tried it with the MIDI Remote but in JS you can easily wrap a function within setTimeout() to break it down into separate stacks.

As long as you’re not expecting anything back, should be easy to do (in my mind at least lol).

i.e. AJAX calls have to be asynchronous, if not most websites would be causing your browser to pause as it fetches external lookups. Going async:false is very much frowned upon so asynchronous methods are a common staple of JS development.

Thank you all for your replies. I do appreciate :slight_smile:
I will double-check using sendMidi later today (not at my desk) and if I can’t make it work I will send you my code (which actually is based on a Martin’s example code…)

1 Like

OK… good news… :slight_smile:
It turns out the problem came from the MIDI Monitor app which I was using and gave me false results (incomplete sysex messages).
I did manage to use sendMidi to send sysex messages.
I do hope that the API will be expanded to provide better tools than the sendSysexFile method :wink:
In any case I will probably make a couple of videos to explain how to use the tools for non-programmers, as you only learn from examples with such tools…

1 Like