Writing SysEx in MAX for a DX7

    Oct 19 2012 | 10:51 pm
    As Forest Gump once said: I am not a smart man. So I might need a little help, or a push in the right direction.
    I've got a project I'm working on, and it's a pretty simple idea: build a DX7 patch editor that you can control with an external midi controller like the one attached.
    I think the problem is that I suck with sysex, and don't quite understand what I need to do to make Max send a DX7 the appropriate MIDI messages (to change the DX7's internal sound parameters).
    A point in the right direction?
    Sincerely yours, Nincompoop

    • Oct 20 2012 | 8:49 am
      That sounds like a fun project! First thing you should do is read the dx7 manual and find out how parameters can be changed: http://www2.yamaha.co.jp/manual/pdf/emi/english/synth/DX7E1.pdf
      I took a quick look and it seems that remark #3 on the bottom right of p22 is what you want to do. The most important part from the manual is the midi specification, which defines how the machine responds and sends out midi data, it starts on page 30 (it may look a bit scary). I think what you need is on the bottom right of that page (1.2.4) which seems to define how a sysex message for changing a voice parameter is set up.
      What it is: a list of bytes (you could see them as numbers) that have to be sent for that certain command, with some data left open and for tou to fill in. As you can see, it starts with a status byte (still talking about 1.2.4), and a little further down needs a parameter to change (0ppppppp) and the data for that parameter (0ddddddd). You can find these parameters on the next page (you need to send the oarameter number in the message).
      So basically what you do is fill in those missing numbers for the command you want to send, construct a sysex message out of it, and send it. And i think you need to make sure that the memory protection of the dx7 is off.
      Hope that clarifies things a bit, feel free to ask anything,
    • Oct 20 2012 | 9:08 am
      A little more info: - what you need to do is send 7 values (look at that 1.2.4 on p30, its a list of 7 values) - what you see there are binary numbers, you should convert them to decimal (http://mistupid.com/computers/binaryconv.htm) - any letters you see there should be filled in by you - you can use this max obj to send a list of values: https://cycling74.com/docs/max5/refpages/max-ref/sxformat.html
    • Oct 20 2012 | 9:45 am
      So when looking at the values you need to send: - first, the standard sysex startbyte (also mentioned on the docpage for sxformat): 11110000, which is 240 in decimals. (Please note that all bytes are 8 bits, they consist of 8 zeroes or ones)
      - then, the identification number: 67. It's already given in decimals, no need to convert it (the max object i mentioned uses decimal values)
      - third is a combined one, we need to send both the substatus and the channel here. I have no idea what the substatus is, but let's just do what the manual hints: substatus=1, channel=0. Looking at 0sssnnnn (a binary numberstructure) it appears that we need 3 bits for the sub and 4 for the channel, but this is a little weird and leads to something i dont understand a little later on, but here it doesnt seem to matter. So: a substatus of 1 is in binary: 1 or 01 or 0000001. According to the manual we need to fill the three locations marked with an s, so we use 001. The channelnumber value is 0 (seems to equal midichannel 1) and that is in binary (with 4 locations to fill here) 0000. So when we fill in 0sssnnnn we get 00010000, which converts to 16.
      - then,we need to send the parameter group number. When looking at the next page in the manual, g=0 is used for the voiceparameters and g=2 for some specific functions and settings like pitchbend range. Let's say for this example we want to set the 'Op6 operator output level' to 20 (just one of the many voice parameters i picked in the list on page 31). So, we want to change a voice parameter which means we need to set g to 0 for this byte.
      - (by the way, i have no idea why the manual says 0ggggggpp for the previous byte, it appears that we need to enter two variables here, but i don't see any mention of that, there's just a group number, so let's assume that it's a mistake or a confusing notation, and that it is 0ggggggg)
      - on to the next, the parameter number that we want to change. As i said, we want to change the op6 operator output level here, which you can see in the list has a parameternumber of 16.
      - (again, a little confusion here on my part. The manual says 0ppppppp for this previous entry, which implies that you have 7 bits to fill for this value. However, 7 bytes gives you 128 possibilities, and as you can see in the list, there are more than that. I assume here that you can use the full 8bits as in pppppppp. You probably dont need to worry about this, since you can just get the decimal value for the parameter that you wan to change)
      - then, the value to set the parameter to. We chose 20.
      - finally, a codeword to let the synthesizer know this is the end of this sysex command: 247
      Which leads to this list of numbers to put in the sxformat object and send to your dx7: 240, 67, 16, 0, 16, 20, 247
    • Oct 20 2012 | 9:48 am
      (By the way, i have no idea if this works....this is what i make out of looking at the manual)
    • Oct 22 2012 | 1:21 pm
      I hope this helps you out. Let us know how you get on.
      This patch has a couple of examples and includes a comprehensive list of all of the values you need to give to the [sxformat] object that can be edited on the original DX7 (don't know about any other version).
      Just replace the "xx" with "/ in $i1 /" and feed the [sxformat] object data from your midi controller. (You will want to scale the 0-127 values from your midi controller down to values that are suitable, eg the Operators on the DX7 require values of 0-99, etc).
      I've also attached two text files for the Edit and Function sysex values. Both of which came from Clyde's Midi bus stop website (http://web.archive.org/web/20060225110206/http://home.worldoptions.com.au/jonescnt/jonescnt/downcont.htm) and both of which I've edited to the values that the [sxformat] object will accept.
      It works with my DX7. Unfortunately it's not smooth sailing though. I'd really like to be able to edit the DX7 in realtime without the sound glitching at all but my DX7 can't handle being edited in realtime via sysex without it's output being interrupted. I'm super keen to know if anyone else has managed a method that doesn't have this issue....???
      BTW, Thank you everyone over the years of my lurking and browsing this forum for all your help. I've pretty much always found answers to my questions and I've never needed to post. Thank you all.
    • Oct 22 2012 | 4:26 pm
      I worked on this with a student of mine for one of his projects. There's not a method that I was able to find that could do it glitch free. Certain parameters you could sort-of get away with, but not most.
      BTW, the sysex for the DX7 is very similar to the TX-802.
    • Oct 23 2012 | 12:38 am
      Thanks Peter for the reply. It's disappointing as I have the TX816 + DX7 and real time manipulation of this setup is something I'd really like.
    • Oct 23 2012 | 12:59 am
      I gotta say you guys, I am overwhelmed by the helpfulness.
      Pvdn– Thank you for this in depth insight into the DX7 manual; this greatly improves my sysex literacy, and I feel significantly more equipped to handle patch programming in general. I learned about twenty things from your posts.
      P.s. – Thank you for confirming my confusion over esoteric values such as 0ggggggg.
      Joeman– you gave the entire patch...Wow! I can see how extensible it is. You made quick work of my little project. It's funny how complicated I thought this would be; a few patches and bam, all the tools you need.
      By the way, I have a DX7s, and I have the same glitchiness. I suppose these internal parameters weren't meant to be manipulated dynamically? It's a shame.
    • Oct 23 2012 | 1:54 am
      "I'd really like to be able to edit the DX7 in realtime without the sound glitching at all but my DX7 can't handle being edited in realtime via sysex without it's output being interrupted. I'm super keen to know if anyone else has managed a method that doesn't have this issue....???"
      no synth i know is able to keep playing while receiving sysex.
      you could say this is the main difference beween parameters which can be controlled by continuous controlles and such which can only be edited by sysex. sysex in that way is more similar to sending the device a new patch which overwrites the old one than using CCs.
      p.s.: so if using a knob controller, you might want to use something like [thresh 250] in max to reduce the sysex commands.
    • Oct 23 2012 | 5:06 am
      As Peter pointed it out, I had made some sysex templates for the oberheim matrix 1000 to control it back in the atari days, and I made it again with my Novation x station controller. In both cases, there was no way you could use it live as a modulation source without glitches. Still useful to edit the matrix though, because that was the only solution for this preset beast.
    • Oct 23 2012 | 5:34 am
      I generally view sysex edit messages as the manufacturer saying "in no way do we want you to edit this while you play--why else would we make it such a pain to edit?..." Shame, but it's one of those functionalities that the commercial market has little use for, but anyone who pokes around further really wants.
      The good news: you could just build the DX-7 in MSP...
    • Oct 24 2012 | 7:28 pm
      Is the MSP DX7 virtually the same, or does it vary in any way, other than the DAC stuff?
    • Oct 24 2012 | 7:48 pm
      Not saying I have, but you definitely could. I would probably not build it the same because there's some things about the DX7 that are absolutely a pain to deal with. For example, its envelopes use a rate mapping so that you can have very long envelopes as well as very short ones (and only with 100 values!), but that doesn't really make sense when you can supply actual time values in Max. (Here's where live.dial's exponential mapping is really useful...)
      Also, the breakpoint mapping (that weird X diagram on the front panel) is confusing as hell to most users, it seems...
      I'd highly recommend using a higher sampling rate (88.2 kHz) if you wanted to reimplement it, since this will reduce aliasing, esp. on higher notes.
    • Oct 24 2012 | 7:59 pm
      Thank you Peter. Very interesting. I'll have to look into this.
    • Dec 28 2012 | 7:35 pm
      @Roman: The elektron machinedrum can take SysEx without glitching.. an example is manipulating the tempo over the factory limits of 2x - 300 bpm. :)
    • Dec 28 2012 | 7:41 pm
      @pvdn the integer boxes can also be used as a decimal <> binary <> ... converter.. they are very handy!
    • Dec 28 2012 | 7:48 pm
      Regarding the SysEx 7 bit part. I'm very puzzled by this. I'm building a MachineDrum SysEx editor, and have quite a bit of trouble figuring out why some SysEx data sets are packed in a weird way.. something about the most significant bit is sent in a 1 byte package before the next 7 bytes of the rest of the information.. I'm very much struck of confusion - and are pretty sure i'm mixing terms up.
      There is a (old) thread about it here - but I don't seem to understand. If any of you SysEx / MiDi gurus have they time, I would very much appricitate a pointer.. i've tried to search around for an explanation, but I don't really know what to search for :)
    • Jul 20 2013 | 8:29 pm
      thanks pvdn for your breakdown of sysex info! i am currently writing a blofeld midi editor, my first project, and your post has been very helpful
    • Apr 08 2014 | 5:23 am
      Hey all,
      I have found the information in this thread really useful. I was wondering if anyone has found a way to format sysex info to write voices to the original DX7, not just individual parameters like Joeman's contribution ((My limited understanding)There may me a way not highlighted in bold for me)). Where I am falling short is the ability format the sxformat object to write full voices to the DX7. In the patch I have included, an adaptation of Joeman's example patch, I can edit the algorithm and output level of each operator. The problem I have is when I store the voice the changes are not recognized.
      In my example patch, the algorithm changes the value on the lcd of the DX7. When I go to change the output level of the operators it changes the values of the output in terms of the audio but the values are not changed on the LCD. This is only what I have observed and may not be the root of my quandary.
      Thank you for anyone that has had the time to look at this.