Talk to other MIDI Designer users about MIDI Designer, iOS MIDI and related topics. Or share layouts, pages, and ideas.

Also check out the Facebook Group.

Of course, if you want to send us an email, feel free.

MIDI Designer
Design your perfect MIDI controller for iPad, iPhone and iPod touch.
14bit signed and unsigned midi data packets? - MIDI Designer Q&A

14bit signed and unsigned midi data packets?

+1 vote
asked Sep 1, 2018 in Advanced by thedood (850 points)
I'm pretty sure that's exactly how Sysex, NPRN and 14-bit CCs work in MD, and we do give you the option of LSB first (it's a toggle). Are you not seeing these options under the message type you need?
Hi, thanks for the reply. Yes, certainly can see and use NPRNs, but they cant be "wrapped" in Sysex. The problem is, I need to inject the data (like the string replacement for the value V in MDs sysex hex/string builder) into a Sysex call.
For example
      F0h = sysex message
      18h = EMU ID
      21h = E4 ID
      xxh = Device ID
      55h = Special Editor designator byte
      xxh = Command type
      xxh = Byte Count
      xx,xxh = Parameter ID
      xx,xxh = Data
      F7h end of SYSEX
I need the 2 byte data portion to be converted to this 14bit unsigned/signed state. If I select NPRN, I can then no longer inject the sysex? Hope that makes sense. I was thinking I could use 48 buttons set to transmit a sysex value for each change in data (hard coded) and use a knob to supercontrol. But, this would get a little time consuming and there are other parameters that need -100 to +100. But, that may be overkill lol
Cheers
Im so sorry, I just re read your reply,  "I'm pretty sure that's exactly how Sysex,...work in MD". So if the data portion is in two bytes, its converting it into the 14 bit packet required? I can easily get it to go from zero up to +24, the problem is getting it to go into the negative state 0 down to -24, (this is when the 14 bit packet needs to be signed negative) the only way I can do that is to hard code the required V datapacket into hex and transmit it via a button. Ill do some more testing today.
Regarding the signing, in the worst case you'd need to use sequential subcontrols to cover your whole range. In the even worse case, you might need to use named ticks to make sure that everything lines up exactly as you need. It'll be a bit of work to figure it out, but beyond that you'll be rocking.

4 Answers

+2 votes
 
Best answer

Amadeus -

Midi is 7 bit math, not 8.  So 7F7F IS 16383.

I have not yet found a valid Midi Message that Midi Designer cannot send.

Midi Designer does NOT need to do twos complement.  You just do it in the spreadsheet you use to generate the named tick values.  But avoid spreadsheet built in hex conversions, as they are all eight bit.

I put the solution I laid out in a control, captured the output, and you see the messages count up to 7F 7F, then 00 00, 00 01, etc.

Images
IMG_0069.PNG
IMG_0069.PNG
answered Sep 12, 2018 by jkhiser (10,590 points)
selected Sep 13, 2018 by thedood
jk...THANKYOU for this. If I could buy you a beer and send over the wire I would.
I didn't do what you said in the first post correctly.
The only problem now is I have to covert around 20 controls to 128 and 256  dimensioned arrays!
I over analysed the problem, I do it often, and I need people like you to hit me on the head with a stick to get it through my brain.
Thanks again, its working perfect!!!
Youre a legend!
Cheers
Just one more question, is there anyway I can import the lists if I do them in a csv or spreadsheet etc?

Edit *** Sorry buddy, worked it out, in the tick editor, select edit text then I can paste large space/tab separated lists.
This is really cool, thankyou again!

Cheers
+1 vote

Solution 1... not perfect, but very workable.


MIDI Target Manufacturer(s): Other/Unlisted Maker

Basically, we are going to use 2 controls, instead of one. One control for the positive sliding, another for the negative.

Heres the example and work around incase it helps someone, if anyone can add any tips, please do, Im new to MD2.

The Sysex command for an E-mu Master Tuning Offset parameter (37h, 01h) is as follows :-

F0 18 21 00 55 01 02 37 01 00 00 ** F7

The * is a standard Roland checksum (you can use F7h to ignore checksum), the green is the parameter ID (Tuning Offset), the blue is the data needed to change the tuning. (LSB first)

A data value of 01 00 sent to the sampler changes the Tuning offset from 0 up to 1, a value of 02 00 changes it to 2 etc etc simple enough.

But if I want to change it to -1 (negative) I have to send a data packet of 7F 7F (2s complement). If I want to change it to -2, its 7E 7F, -3 is 7D 7F etc etc

So to do this we can use two dial controls. Set them both to send Sysex and load the commands. One control should be named Positive, the other Negative. One control will slide from 0 through to 24 the other will slide from -1 to -24

We simply set the fist controls sysex V (value) to one byte, enter V 00  for the data packet (as its always 2 bytes for E-mu, you could set the V (value) to 2 bytes, but, for this example, I'll leave it as 1 because when we do the negative control we will be forced to use only one V byte). Set the controls Midi Min Max to 0 - 23, set up a Named Ticks for pretty UI if needed and it will work fine.

For the Negative control, set it up the same (Copy Similar) but we are going to change a couple of values. 

First, set the data portion of our Sysex to V 7F (2s complement) and set the Midi Min Max to 127 - 104 (this will output 7Fh to 68h) , recreate/number your UI (tick lists etc) and now turning the knob sends the E-mu 14 bit signed numbers and we can dial from -1 though to -24.

To the MD2 team, I love this app, its sooooo cooool!! Keep up the great work!

Cheers

Brett (Thedood)

answered Sep 2, 2018 by thedood (850 points)
edited Sep 17, 2018 by thedood
0 votes

Solution 2 - Carry on from solution1 - Make it one control.


MIDI Target Manufacturer(s): Other/Unlisted Maker
Ok this is a carry on from 1st solution I created above. Basically, after reading the manual further, I can now get this to work fine using one control.

Do exactly as I said in Solution 1, add two controls, and set the Sysex up.

Then, create a new Knob/Slider control, make it a Supercontrol, and then add both the negative and positive controls to it, as sub controls.

Then make the Supercontrol, "Sequential", by selecting Sequential in its "SuperControl Options". Setup the ticks etc to the total of the subcontrols, and it now slides through both controls as if they are one. Perfect.

Sorry, it just took me a while to get up to Sequentials in the MD2 manual!

I frickin love!! this app,  Im screwed if I knew how I went so long without it.

Cheers

Brett
answered Sep 5, 2018 by thedood (850 points)
+1 vote

Wouldn't named ticks work?


I have to do this a lot with Roland, which jumps around with nibble math, etc.  Use a spreadsheet to calculate the correct MIDI number to give to MD for the range of values, from -24 to + 24, add a column for the display value, and shove into a SYSEX control knob, with two byte V.  SYSEX commands type in HEX, but the values in named ticks are stored in decimal.  16383 (3FFF) should be -1.

So your table of values will (probably) look like:  (Midi first, display second)

16360 -24

16361 -23

...

16382 -2

16383 -1

0 0

1 1

2 2

...

24 24
answered Sep 5, 2018 by jkhiser (10,590 points)
*** Edit Ignore everything I said here...I wasnt on drugs but I wish I was.. then I would have had an excuse! lol ***

Hi jk, thanks so much for your answer. Unfortunately it cant work... well for Emu at least. The reason being, even though I use named ticks, the Midi data sent over the wire can never go below 0 or above 16383 (3FFF) in 2 bytes.  The problem is the part I stated in the original question, that Emu wants its input variable (the data) formatted in signed/unsigned 14 bit values (using 2s complement binary addition), the problem being that when it comes to Sysex, the manufacturer calls the shots, as what's inside a wrapped Sysex string  doesnt have to have anything to do with Midi as a standard. For example, (and this is verified through testing, as it works perfectly using my method,) if I want to change a value from 0 to -1, I have to send through a 2 byte value of 7F7F. Now if you work out the value of 7F7F as an unsigned number its actually 32639. If I want a value to change to -3, I have to send 7D7F, as an unsigned integer thats 32127. These are numbers I cannot send in 2 bytes from MD2, as the only way of representing say 32127 as a Midi value is to use 3 bytes not 2. (Midi only uses 7 bits of our 8 bit byte). The problem is MD2 cannot perform 2s complement functionality on my two bytes Im sending to the Emu sampler. I have to "hack" it, as seen in the method used in Solution 1. MD2 can ever only send Midi values from 0 - 16383 in two bytes. The question then is, how do I send a number using two bytes "AND" sign it as either negative or positive. Im guessing the Roland unit you're using states in its Sysex documentation, only ever send me positive numbers (unsigned) and ill map them to negative values internally (like in the example you showed, named ticks work fine, as we are never actually sending the Roland unit "negative" or signed packets). This is what most manufacturers do, simply map unsigned midi data to signed numbers internally depending on the synths programming, to save the hassle of converting bytes to signed/unsigned (pain in the arse lol). The Emu wants its data as "signed" packets, taking a bit from the end of a byte and say that if its 1 its negative and if its 0 its positive. This is what 2s complement is used for a lot, representing signed numbers in binary. You can see that in the MD2 midi values screen, data is only ever sent as 14 bit unsigned, meaning I can only ever send 0-127 ( 1 byte) or 0-16383 in (2 bytes), but I really need MD2 to be able send actual signed/unsigned values from -8192 to +8192 in 2 bytes. Its just one of those rare instances where MD2 cant fully give what the manufacturer wants, but the hack is working fine, it just takes more time to implement. Hard to explain I know, its just my luck I decided to tackle a Synth that funnily enough has NEVER been tried. There is nothing available for Emu Samplers remote control except of a very limited panel using Ctrlr (Windows open source Midi controller). Even MidiQuest didnt bother trying to do the Emus, and they do nearly everything.
Cheers
...