Edit MIDI Sysex Data With Hex Fiend

DISCLAIMER1: I wrote this several months ago on v1 of the Take5 firmware. I have not tested using v2 of the firmware.

DISCLAIMER2: Proceed at your own risk. I take no responsibility if something goes wrong with your .syx or your synth.

Edit MIDI Sysex Data With Hex Fiend.

When a user program is dumped from the synth to a .syx file via MIDI, the bank and program number is always included in the data. This means that when a saved program file is transmitted back to the synth, it will always write to the same bank and program slot.

This is standard for saved synth patches. Conscientious sound designers will tell you which banks any purchased soundpacks load into:

These patches will load to the following spots on your Take 5: 401-416, 501-516,
601-616, 701-702.

The problem is how to make a user bank with the desired program in a differnt slot. Without dedicated librarian software, curating various disparate patches into select, personalized user banks might involve a juggling act of manually duplicating patches into free user bank and program slots on the synth itself. Alternatively, it should be possible to plot out bank destinations against a paper list of programs (aka "patches"), then alter the saved .syx files before uploading back to the synth. This is the overly technical, hard way to to do it, but to satisfy my curiosity, I took on this technical challenge.

I will demonstrate using the Take 5 synthesizer from Sequential.

A Hex Editor (such as Hexfiend on Mac) can be used to alter the byte data in the .syx file to change the bytes which control bank and program.

Say we saved a new program to slot 101 (User Bank 1 Program 1).

synth1

And an empty program slot in slot 816 (User Bank 8 Program 16)

synth2

To export (dump) the patch to your Mac:

software1

software2

synth3

software3

software4

Before working on the data in this file, we will look up the relevant documentation in the MIDI Implemenatation chart.

The "Program Data Dump" table on page 16 has the relevant information.

documentation

With the binary data above, apply formatting with alternating spaces and newlines every four characters. This will correspond to the first four bytes of data as described in the implementation. The first four lines of the table describe the data in the first four bytes. These are headers which won't change. Every program dump will start with the same headers which say to the listening MIDI device, "This is a system exclusive message. This is for manufacturer number 1, Dave Smith Instruments (DSI). This is for product number 53, the Take 5. This is data for a Program."

In Hex Fiend, Examine the first word, "F0013502". The binary equivalent in the left column, should read 11110000000000010011010100000010. If broken up into 4 pairs of four digits, it is:

Copy
1111 0000
0000 0001
0011 0101
0000 0010

These should correspond to the header values in the chart.

It is the next two lines of the table, and thus the next two bytes, which concern us:

Copy
0000 00vv # Bank Number: 0-15
0vvv vvvv # Program: 1-16

The chart tells us that this is formatted as "0000 00vv", the "v" character meaning that these values are variable.

Note: The MIDI implementation chart is slightly flawed in outlining 1-indexing and binary notation. Lines 5 and 6 on the table should really read:

Copy
0000 0vvv # Bank Number: 0-7
0000 vvvv # Program Number: 0-15

Line 7 of the table says '4096 bytes expanded to 4695 MIDI bytes in "paked MS bit" format'. This is the data which records synth parameter values such as cutoff frequency, ADSR envelopes, oscillator levels, and etc. Interpreting and editing this data manually is beyond the scope of this article.

Scroll to the end of the hex byte data and see the last value: 0000F7. The binary is 000000000000000011110111. The final byte is 1111 0111, which matches line 8 of the chart, and means "End of Exclusive (EOX)". End transmission.

In Hex Fiend, examine the second hex value, 00000C02, which starts with bytes 5 and 6. These are the two actual byte values we will be changing. This binary breaks down like this:

Copy
0000 0000 # "Bank 1"
0000 0000 # "Program 1"

Because we saved the first patch from the first bank, our variable digits are 00. These numbers are zero-indexed, meaning we start counting at 0, not 1. If we wanted to bump this up to "Bank 2" (human-readable, 1-indexed), we would actually set this to 01. Likewise Bank 3 would be 02 (again, counting "zero one two").

For handy reference, I have written a simple Ruby script to output the numbers 0 through 15, in binary, with comments mapping that to 1-indexed human-readable text.

Copy
> (0..15).each { |x| puts x.to_s(2).rjust(8, "0") + " # #{x}: \"Slot #{x + 1}\"" }
00000000 # 0: "Slot 1"
00000001 # 1: "Slot 2"
00000010 # 2: "Slot 3"
00000011 # 3: "Slot 4"
00000100 # 4: "Slot 5"
00000101 # 5: "Slot 6"
00000110 # 6: "Slot 7"
00000111 # 7: "Slot 8"
00001000 # 8: "Slot 9"
00001001 # 9: "Slot 10"
00001010 # 10: "Slot 11"
00001011 # 11: "Slot 12"
00001100 # 12: "Slot 13"
00001101 # 13: "Slot 14"
00001110 # 14: "Slot 15"
00001111 # 15: "Slot 16"

Let's alter the .syx data, so that when we send the MIDI sysex back to the machine, it will load into Bank 8, Program 16:

Copy
0000 0111 # "Bank 8"
0000 1111 # "Program 16"

Select-dragging with the mouse over the binary will choose 8 digits at a time (a byte). Selecting the first from the left, I recognize it is 00000000 for the bank number, as determined above. Selecting the second byte from the left, I recognize it is 00000000 for the patch number, as determined above.

software

To change a value, double click on the binary digits in the Data Inspector at the bottom of the window. There should now be an editable field. Enter 00000111 for byte 5, and then enter 00001111 for byte 6.

software

The final result should look like this:

software

In the Hex Fiend menu bar, use File > Save As and enter a new filename. Note that the program will always append ".*" to the file you "save as". As far as I can tell, this is a bug in Hex Fiend. Find this file in the Mac finder and rename the new file to remove the ".*", so the correct extension is ".syx".

Now to test the results, in SysEx Librarian, choose File > Add to Library from the menu bar, and open the new file. Make sure the MIDI source dropdown menu shows "Take 5" as currently selected. and click the ▶ play button. The screen on the synth should show that it is receiving data. After it has finished receiving the sysex transmission, the program will be loaded into slot 816 (User Bank 8, Program 16).

software

TAGS MIDI


Back