fbpx
Skip to main content

MIDI Forum

How to build a .syx...
 
Notifications
Clear all

How to build a .syx from HEX string on mac?

12 Posts
3 Users
0 Reactions
18.5 K Views
Francesco
Posts: 7
Active Member
Topic starter
 

Hello everybody, I'm new with the forum and I hope the question will not be too cheap 😉

I'm trying to communicate with my hardware synths via mac. I'm using Librarian and Midi Monitor for checking the messages, and everything works well, but I would like to send a specific message in HEX for requesting a patch dump.

How can I build a correct file with the HEX digit to be sent via Librarian?

Thanks

 
Posted : 17/04/2020 10:53 am
Geoff
Posts: 1039
Noble Member
 

I assume that you mean that you want to create a file containing the raw data of a SYSEX instruction to send to a device. As you ask about creating it directly as hex then I assume that the 'librarian' system you have does not allow the data to be entered in a more friendly format?

When I've needed to do this, I've used a text editor to create a dummy file, comprising for example n space characters. The actual characted does not matter, only the size of the file is important. It should contain the correct number of characters for the data you wish to send.

Save the file as text, then open it again using a hex or binary file editor. I assume such things are available for a mac. I have various such things back to DOS days, and later WinDoze variant. This will show the file as a succession of bytes each being 20 (hex). Then amend each byte in turn to the value (HEX) that you require, i.e. for SYSEX the first byte shoud be F0 and the last byte shoud be F7.

When done, save the file as .syx. Or re-save it as text and then rename as .syx.

If you like, just send me the data as text (in a posting) and I'll post a binary version back.

Geoff

 
Posted : 17/04/2020 11:40 am
Pedro Lopez-Cabanillas
Posts: 154
Estimable Member
 

You may use the good old Bash shell, that is, the program that runs when you open your macOS terminal and executes your commands. For instance, this command creates a "test.syx" file using hexadecimal values "on the fly":

[code type=markup]
echo -ne "\xf0\x41\x0a\x0b\x0c\x0d\xf7" > test.syx
[/code]

If you open it in Snoize's Sysex Librarian, it says that the manufacturer is Roland, because 41 hex is the Roland identifier, but the content is nonsense. Don't send it to a real Roland device!. The trick is to prepend each 2-digit hex number with "\x" inside the quote delimited string.

If you prefer to work with disk files, writing the hex numbers as text and then translating them to binary SYX files or vice versa, you can use several Unix utilities:

https://www.unix.com/man-page/osx/1/xxd/
https://www.unix.com/man-page/osx/1/od/
https://www.unix.com/man-page/osx/1/HEXDUMP/

 
Posted : 17/04/2020 2:32 pm
Francesco
Posts: 7
Active Member
Topic starter
 

Thanks for the replies, but seems to be harder than I figure. I try to post a concrete example for what I would need.

I'm trying to send this message F0, 42, 3A, 71, 10, F7 to my Korg Electribe Sx and it should be a global Dump request.

If I try to create a text file with this and converting to .sys, librarian doesn't accept this file because it says that doesn't contain any sysex message.

I'm trying to come out from this.

 
Posted : 18/04/2020 2:42 am
Geoff
Posts: 1039
Noble Member
 

OK, you do NOT use a txt file, my reference to that was just to create a dummy file to then edit into a binary file.

I've created if file test.syx which contains the binary (hex) data you suggested, although I'm not sure there is enough data there for a normal SYSEX command - however, you device may have a 'special' command available which needs fewer bytes than normal.

The file is in a .zip file, which IS allowed by the forum, whereas a .syx file is NOT. The zip file is MUCH bigger than the file you actually want, I know. Zip format is NOT intended for 8 byte files!! The file I've created ends up with a spurious CR/LF on the end, which I cannot get rid of, but the SYSEX part is complete and should work IF the data you've given is correct. You may get a complaint about unrecognised data afterwards, but try it?

Geoff

 
Posted : 18/04/2020 6:36 am
Francesco
Posts: 7
Active Member
Topic starter
 

Hey Geoff, many thanks and it works exactly how I expected. Great!!!
This was a command to request a dump of the current patch for the esx and it works. I have also tested resending the reply (acquired with Midi Monitor, Saved, Changed the extension and resent via Librarian) from the Esx and 100% works.

since I'm new as I mentioned, I'm trying to understand you when you write "create a dummy file to then edit into a binary file" is there a specific sw I can use for this on mac?

I hope this is not too stupid question 😉

 
Posted : 18/04/2020 7:30 am
Geoff
Posts: 1039
Noble Member
 

Thanks for the update. I thought it MIGHT work, the Korg was clever enough to disregard the garbage bytes. Once you've got something into the librarian you should be able to copy bits to make other commands?

Geoff

 
Posted : 18/04/2020 7:54 am
Francesco
Posts: 7
Active Member
Topic starter
 

Unfortunately not...I can only see the content of the file with the HEX digits but I can't edit...That's the step I'm missing!!

 
Posted : 18/04/2020 8:05 am
Geoff
Posts: 1039
Noble Member
 

Oh?

I would have expected that a librarian would allow you to maintain/modify any items stored.

What is the name/publisher etc of the librarian software, and I'll see if I can find out anything about it. If it's mac software, I cannow run it myself.

If you've been able to load my file, and load the one you saved from the Korg's reply, then that's something. I can easily create others, or we need to sort out a way you can do something similar for yourself. Try Pedro's command within BASH? This is the mac's equivalent of the 'Command' screen within WinDoze.

Geoff

 
Posted : 18/04/2020 8:17 am
Geoff
Posts: 1039
Noble Member
 

There is another option, if you prefer.

If you can create midi files easily, then you can use midi files.

Basically, the midi file is created as normal, but you add no music data to it (notes on, off, etc), but then you add SYSEX data into the file to do the function you need.. Then, when required, you 'play' the midi file, but the SYSEX is the ONLY data that is there to be sent.

If you have software to create midi files, then it would normally be able to add SysEx messages, and there's nothing wrong with a midi file containing SysEx ONLY.

I could create a file which contains the command you've gived ONLY if you like?

Geoff

 
Posted : 18/04/2020 9:05 am
Francesco
Posts: 7
Active Member
Topic starter
 

I have tried the Pedro's suggestion with terminal but the command doesn't create me a file.

I now try with the midi file!!

 
Posted : 18/04/2020 9:18 am
Francesco
Posts: 7
Active Member
Topic starter
 

I finally arrived at the end. Building in logic a midi file as you suggested Geoff!

.mid can be uploaded and sent in Librarian 😉

 
Posted : 18/04/2020 10:44 am
Share: