Any software engineers or programming types out there?

Discussion in 'Effects [BG]' started by JehuJava, Oct 6, 2012.

  1. JehuJava

    JehuJava Bass Frequency Technician

    Oct 15, 2002
    Oakland, CA
    Not really sure if this is the right forum, but OT didn't seem as applicable.

    Basically I want to make a patch/preset editor for my own use but no idea how to go about it. The pedal, that I'd rather not speak aloud, has the ability to import and export presets. But when I open the preset file in a hex editor it makes no sense to me. One file has all the preset data. Could someone point me in the right direction?

    I have some VB experience, and I'm not afraid to spend the time learning a new programming language or whatever it takes really. I have a graphic design degree, so you can imagine I like pleasant GUI's vice crappy LCD menus.

    I'm not trying to break the law or reverse engineer proprietary information. I just want to make editing presets on a very complicated pedal much easier so I can have some fun with it.
  2. MontzterMash

    MontzterMash Supporting Member

    Dec 6, 2010

    First step is going to be to figure out what the structure of that preset file is. That's going to be the biggest factor in the difficulty of this. Since you mentioned a hex editor, I assume it's a binary format of some sort.

    The general ways to do that are:

    1. Google first, and see if someone else has already reverse-engineered the file format. Could be someone here knows too.

    2. Get a variety of preset files that vary in an organized way, and start looking in them and figure out what every byte does. That's a bit like learning music by ear - the more you know a lot about how people encode things in binary file formats the quicker you can recognize the patterns and figure it all out. First time you try it, it can take a while, and be quite daunting, so be prepared for a lot of trial and error. Positive way to look at it - much of that trialing involves playing with your bass through the pedal to see what things sound like.

    After that, you can figure out what languages or libraries you'll need to use. Most likely, VB will be fine if that's what you like using.
  3. JehuJava

    JehuJava Bass Frequency Technician

    Oct 15, 2002
    Oakland, CA
    Good idea. I can set all params in preset 1 to 0 so to speak. Then adjust param #1 to 1 then 2 then 3 etc saving each version as preset 2, 3, 4 etc. pretty much running through all the permutations watching how the code cahanges. This should show how the coding works. I imagine after I do a few parameters I won't have to go through each value for each parameter...probably 0, middle, and max.
  4. There is no shame here we are all effects addicts.
  5. megafiddle


    May 25, 2011
    You will probably only have to figure out the coding system for one preset.
    The rest of the presets will likely use the same format and appear as a sequence
    of data blocks, one block per preset. Once you have one, a few quick tests might
    identify the others.

    You might also see header information at the beginning of the file which identifies it
    and never changes.

    Also you might see a byte or two at the end that always changes along with any other
    byte. This would be a checksum and you would have to determine how it's generated
    and generate it each time the file is edited.
  6. drewfx


    May 14, 2009
    You might search on midi sysex programming. Even if your gear uses USB (or whatever) instead of midi to transfer data, the principles are the same. And the data may be structured similarly if the manufacturer used midi for earlier products.

    First thing is to see if the manufacturer will provide you with documentation for the file format (if it's not already available). If not, you have to figure it out the hard way - change something and see what changes in the data. It's also likely that there may be checksums at the end of the data and sometimes every x patches. If you have alphanumeric patch names in the data, it's easy to see how many bytes each patch is by looking for that.

    I used to use VBA to load a sysex file into an Excel spreadsheet to try and figure out what was going on. You want to be able to convert from hex to decimal to match most of the settings to what you see on the HW. But sometimes they spread data across more than one byte or pack more than one parameter into a single byte, so be aware of that.

    Also note that some devices don't like it if you send them data they don't understand. I've had stuff lock up on me and had to open it up and disconnect the little battery to reset things.
  7. JehuJava

    JehuJava Bass Frequency Technician

    Oct 15, 2002
    Oakland, CA
    Woof. The two things I was afraid of. Check sum and locking it up.

    I suppose I can, once I figure out the coding, compare what my program generates versus what the pedal generates for the same settings.

    This may be a bigger bite than I was expecting. But let's try it.
  8. topo morto

    topo morto

    Mar 22, 2010
    Definitely worth a try - suspect it would be down to the size of the company...
  9. DeltaPhoenix

    DeltaPhoenix Supporting Member

    Apr 6, 2011
    Crappy LCD screen and it is a complex pedal....I know which pedal this is....
  10. JehuJava

    JehuJava Bass Frequency Technician

    Oct 15, 2002
    Oakland, CA
    ok. i'll give this a shot. I guess it can't hurt. Maybe it'll work.

    Yes you do!
  11. megafiddle


    May 25, 2011
    Checksums are usually easy to figure out once you've identified which byte is the checksum.

    In one system, the checkum is nothing more than the lower byte of the sum of all the other data bytes
    (the carry over into the next most significant byte is discarded).

    Another system generates a checksum byte such that when all the data bytes plus the
    checksum are added, the result is zero (again discarding all but the least significant byte).

    You will have to be pretty thorough and careful to avoid lockups. But it can be done.

    How many parameters and presets do you have to deal with?
  12. JehuJava

    JehuJava Bass Frequency Technician

    Oct 15, 2002
    Oakland, CA
  13. NKUSigEp


    Jun 6, 2006
    Bright, IN
    Perhaps it is a 5th^/Oct^ setting on some sort of a pitch shifter and he knows that if it got out, this pedal would cause the destruction of the world and possibly the entire universe.
  14. JehuJava

    JehuJava Bass Frequency Technician

    Oct 15, 2002
    Oakland, CA
    I wish. The builder sometimes shows up here and was hoping not to cause problems. I just wanna make editing easier, albeit offline and not real time. But it can help me get a basic starting point for a preset faster I think.

    15 parameters identified. The remaining are kind of cryptic. And since there are 25 bytes still needing identifying but 30 parameters left, could 1 byte control more than one parameter?
  15. bongomania

    bongomania Gold Supporting Member Commercial User

    Oct 17, 2005
    PDX, OR
    owner, OVNIFX and OVNILabs
    It may be that some group of parameters are enabled or disabled by one bit, so they could be excluded from some strings. E.g. turning an EQ off might mean the control bits for each band are not included. Just a guess.
  16. JehuJava

    JehuJava Bass Frequency Technician

    Oct 15, 2002
    Oakland, CA
    You may be right. Once I narrow down the last few I should be able to see a pattern. Right now there's still a few too many bytes unknown to determine which are which.

    So, an observation that I'm not ready to tackle yet but will have to when I'm ready to program my own presets: I can't tell if their using signed or unsigned bytes. The parameters seem to jump back and forth between the two. Maybe I need to look at each parameter on its own? For instance, one preset has the parameter of 56 in the pedal and so does another preset. When you look at the preset file one string will show a signed value of 56 and the other will show -200. Both are essentially showing 56.

    Another observation is a parameter that is non-numerical, like on or off or mute, is showing up in the preset file as a range. Like 0-6 = on and 7-16 = off. Weird range choices. Or a value of 50 in the pedal shows up in the preset file as maybe 47-53. Decimal rounding? Range? I will deal with this later.
  17. JehuJava

    JehuJava Bass Frequency Technician

    Oct 15, 2002
    Oakland, CA
    So interesting...!
  18. topo morto

    topo morto

    Mar 22, 2010
    In a 16 bit 2's complement representation, I think those would have the same 2nd byte...

    56: 00000000 00111000
    -200: 11111111 00111000

    so could it be that the 56 is actually only an 8-bit value, and the first byte relates to something else?
  19. megafiddle


    May 25, 2011
    How are you looking at the data? As bytes? Or 16 bit words?
    And as hex values or decimal?

    I am confused about the -200; it doesnt fit in one byte which has a range of -128 to 127.

    Does the file end right at the last preset? And are data bytes changing only one at a time
    with a single parameter change? If so, sounds like there are no checksums.

    Sounds like you're making progress. Interesting project. I wrote a patch librarian for my
    DX7s keyboard long ago. For Atari 520ST in GFA compliled BASIC. I had the advantage
    of a documented file structure though.
    With the PC and Windows, I do everything now in C.
  20. JehuJava

    JehuJava Bass Frequency Technician

    Oct 15, 2002
    Oakland, CA
    I think as bytes. Although, I'm using the character representations to do this. This was how I was able to line up the presets in rows to compare characters, by aligning the preset name. Then I looked for the same changes amongst presets by the characters (and the values if to verify). I found the easy ones. But it looks like the rest as combinations and strings. I'm trying to understand what this means by searching the internet.

    I think I got this backwards. I was typing from memory.

    Yes. That's how I determined where all the presets end.

    Making a little bit of progress. I'm basically learning in reverse.