![]() |
#1 |
Human being with feelings
Join Date: Aug 2021
Posts: 12
|
![]()
Could you please advise what is the best way to send MIDI Sysex message from script (actions) to external MIDI device?
Sysex MIDI message is Code:
'F0 21 25 7F 47 50 2D 64 12 11 00 00 02 07 09 00 00 F7' If I send it from MIDI editor everything works fine. But following command doesn't work in a proper way. Code:
reaper.SendMIDIMessageToHardware(8, 'F0 21 25 7F 47 50 2D 64 12 11 00 00 02 07 09 00 00 F7') Code:
reaper.SendMIDIMessageToHardware(8, '0xF0, 0x21, 0x25, 0x7F, 0x47, 0x50, 0x2D, 0x64, 0x12, 0x11, 0x00, 0x00, 0x02, 0x07, 0x09, 0x00, 0x00, 0xF7') |
![]() |
![]() |
![]() |
#2 |
Human being with feelings
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 4,438
|
![]()
you have to send binary string, not regular
Last edited by mpl; 03-07-2023 at 05:07 AM. |
![]() |
![]() |
![]() |
#3 |
Human being with feelings
Join Date: Aug 2021
Posts: 12
|
![]()
Thanks for your replay. Please tell me if I understand correctly that by a binary string you mean something like
Code:
'11110000 00100001 00100101 01111111 01000111 01010000 00101101 01100100 00010010 00010001 00000000 00000000 00000010 00000111 00000110 00000000 00000000 11110111' |
![]() |
![]() |
![]() |
#4 |
Human being with feelings
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 4,438
|
![]() Code:
SysEx_msg = 'F0 21 25 7F 47 50 2D 64 12 11 00 00 02 07 09 00 00 F7' SysEx_msg_bin = '' for hex in SysEx_msg:gmatch('[A-F,0-9]+') do SysEx_msg_bin = SysEx_msg_bin..string.char(tonumber(hex, 16)) end reaper.SendMIDIMessageToHardware(HW_dev_outID, SysEx_msg_bin) |
![]() |
![]() |
![]() |
#5 |
Human being with feelings
Join Date: Aug 2021
Posts: 12
|
![]()
Thank you very much! You helped me a lot.
|
![]() |
![]() |
![]() |
#6 |
Human being with feelings
Join Date: Feb 2022
Posts: 102
|
![]() |
![]() |
![]() |
![]() |
#7 |
Human being with feelings
Join Date: Aug 2021
Posts: 12
|
![]()
I believe that this script should be somehow fixed and highlighted in the API description.
|
![]() |
![]() |
![]() |
#8 |
Administrator
Join Date: Mar 2007
Location: NY
Posts: 17,115
|
![]()
Another way to do it:
Code:
sysex = { 0xF0, 0x41, 0x10, 0x00, 0x00, 0x00, 0x05, 0x12, 0x20, 0x00, 0x40, 0x02, 0x18, 0x06, 0xF7 } msg='' for i=1, #sysex do msg = msg .. string.char(sysex[i]) end deviceid=0 reaper.SendMIDIMessageToHardware(deviceid, msg) Last edited by schwa; 02-11-2024 at 09:21 AM. |
![]() |
![]() |
![]() |
#9 |
Human being with feelings
Join Date: May 2019
Location: Berlin
Posts: 2,551
|
![]()
Also useful in this context is that string.char can take multiple arguments. If one can avoid using tables, this is very fast and elegant:
Code:
msg = string.char(0xF0, 0x41, 0x10, 0x00, 0x00, 0x00, 0x05, 0x12, 0x20, 0x00, 0x40, 0x02, 0x18, 0x06, 0xF7) deviceid = 0 reaper.SendMIDIMessageToHardware(deviceid, msg) Code:
sysex = {0xF0, 0x41, 0x10, 0x00, 0x00, 0x00, 0x05, 0x12, 0x20, 0x00, 0x40, 0x02, 0x18, 0x06, 0xF7} deviceid = 0 reaper.SendMIDIMessageToHardware(deviceid, string.char(table.unpack(sysex)))
__________________
Featured scripts: REAPER Update Utility Lil Chordbox Gridbox/Adaptive grid MX Tuner RS5K Link MIDI Editor Magic Donate💝: PayPal|ko-fi |
![]() |
![]() |
![]() |
#10 |
Human being with feelings
Join Date: Apr 2023
Posts: 65
|
![]()
I'm using reaper.SendMIDIMessageToHardware(deviceid, msg) to send a sysex request message to query a setting on my midi device. This works great but I can't figure out how to receive the sysex feedback message from my midi device. I know my sysex command works as I also sent it via Bome SendFX and Bome did receive the correct feedback. I just don't know how to get the feedback message back into my lua script. Any help would be greatly appreciated? Regards,
|
![]() |
![]() |
![]() |
#11 |
Human being with feelings
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 17,145
|
![]()
maybe ReaPack -> Midi CC to SysEx
|
![]() |
![]() |
![]() |
#12 |
Human being with feelings
Join Date: May 2017
Location: Somewhere over the Rainbow
Posts: 6,882
|
![]()
Added this thread to the Reaper Internals-Thread post that lists useful resources in the forum, so it doesn't get lost to time.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - ReaGirl - a GuiLib for guis working for blind people |
![]() |
![]() |
![]() |
Thread Tools | |
|
|