Negative Signed Hex Values

Hi Steve,

The project for remote control of a DAW (Logic Pro 11 in this case) is almost complete but I have run into an issue with the control of the track pan encoders. I’m using a timer to control the basic midi data stream between 0 - 127 for storing the last know position and then the 1 or 65 method to either turn the encoder CW or CCW which does the trick or so I thought. In Logic the pan knob displays a visual indicator as well as the numerical value on the end of the knob. The logic that I was going to apply was to recall the stored variables that would initialize the pan knob as a preset or simply for project recall. The problem I have is that Logic stores the positioning information in a hex format which I finally figured out. Once again I thought no big deal, problem solved. All I need to do is convert the decimal values into hex values or vice versa and all is done. The pan knob data is displayed as 0 to +63 (cw turn) or 0 to -63 (ccw turn) with 0 being centre. The positive values convert without any problem but the negative values do convert but always to a value if -63. You reference a value of FFFFFFFE as being -2 hex but I have the same problem in that Logic display it as -63. I used a two’s complement conversion which also provided the same result -63. I was surprised that MTP handled hex data in the output stage but was not able to use it in rules. The online converters or spreadsheet formulas simply put a minus sign in front of the positive hex value. The negatively signed values could NOT be entered in MTP which displayed an error. I only need the hex values for recall purposes. The conversion would only occur at project start up as a one shot deal and not be involved in the data chain during normal run time. If anyone has any thoughts on this issue I’m all ears. And Steve, after reading some of your posts on the hex, binary and decimal math issues I now see you as the Brian May of North America

Hi and welcome back!

In Logic, V-Pot rings from Logic are sent with the encoding as follows not as you describe.

image
image

The following should work for translating LED ring values coming from Logic back to an absolute encoder ring requiring 0-127


Incoming : Control change on MIDI CH 1 set CC to pp and value to qq

Rules:

if pp<48 then exit rules, skip Outgoing Action
if pp>55 then exit rules, skip Outgoing Action
// change the below rule to the outgoing cc that you want
tt=pp-47
// strip upper nibble
qq=qq&15
qq=qq-1
// scale it
uu=qq*140
uu=uu/11

Outgoing: Control Change on channel X (you define) CC# tt, value uu.

You may need to change this rule for the controller number you want to use as it is calculated based on which V-Pot you are using.

tt=pp-47

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

Hi Steve and thanks for the reply.

Hi and welcome back!

Welcome Back? I haven’t gone anywhere that I’m aware of…but I’d like to.
Before I move forward with your suggestion I’d just like to confirm that we are on the same page…
I’ve included a link to what hopefully describes my issue. Also is there a way to save hex code values
that contain alpha characters in rules as that would address my issue. I thought that you may have
referenced that in one of the forum posts. Excuse the grammatical errors in the video which I did
in a hurry.

https://storage.googleapis.com/midifiles/logicPanKnobDisp01.mp4

Hi Welcome back was because you hadn’t posted anything in a while.

Well, what you showed me is different than what I thought. I was referring to feedback of LED rings which are generally present on a Mackie MCU device. You are showing the MCU Scribble strip messages which are a special SysEx format.

Some DAWs that support MCU protocol have a way to zero the Pan knobs. I’m not sure if Logic does. Generally the message is an encoder push of the VPOT to reset to zero. We could send these messages to the DAW if you would like but we would need to figure out what trigger you need to send them and which pans you would like to zero out.

The encoders themselves never send an absolute value (at least Mackie MCU only expects relative values) so you cannot tell the DAW with the knobs what values you want.

What type of controller is this that you have? Do the knobs support push function? Are the knobs absolute values?If not, we might be able reset them with your switch. I will need to take a look at the Logic manual to see if it supports a ‘center push’ function.

Late here so will get back to you tomorrow. Stay tuned.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

I realized that I was being way over the top with the reply below so I’ll be more succinct in answering your reply. Please be advised that my question has nothing to do with the Yamaha 01x control surface and see below if you want to know why. I’ve almost completed an interface using an inexpensive 4 button footswitch to control Logic. The user can remotely control transport buttons, faders, mute, solo, record, monitor, pan and punch playback at the track level with the 4 button footswitch not to mention one heck of a lot button dancing. A footswitch like the FCB-1010 or the Nektar unit would be the way to go but from what I’ve read 4 buttons seem to be what people want…

Well, what you showed me is different from what I thought. I was referring to feedback of LED rings which are generally present on a Mackie MCU device. You are showing the MCU Scribble strip messages which are a special SysEx format.

>> Yes you are correct and I’ve included an example in the long message below.

Some DAWs that support MCU protocol have a way to zero the Pan knobs. I’m not sure if Logic does. Generally the message is an encoder push of the VPOT to reset to zero. We could send these messages to the DAW if you would like but we would need to figure out what trigger you need to send them and which pans you would like to zero out.

>> Logic does respond to push button encoder data if available. See below for a complete list. For track one the data is note on/off in the format of 90 20 7F then 90 20 00

The encoders themselves never send an absolute value (at least Mackie MCU only expects relative values) so you cannot tell the DAW with the knobs what values you want.

>> You’re probably right. In an earlier message I stated that I can accurately track the encoder position using decimal data in the form of 0 - 127. I then send the encoder what it wants as in 1 or 65 for CW or CCW rotation. This is also where I’m having an issue with telling the encoder what the position was upon a restart of the whole system or the same when creating valid preset data.

>> PS - I do have the hex data that will set the pan knob position and display value relative to the decimal data stream (0 - 127). The hex data is only used upon startup and storage as the encoder responds to the 1 - 65 relative movement data once given the starting point.

>> OK - now back to the question that I’d like to ask. Of the 128 hex code values that are relative to the positions of -63 through +64 of the pan knob I can use one translator to update 80 of the 128 values as the hex data is all numeric starting at 00 - 79. The related hex data is not linear at all regarding position data but is relative to the decimal stream of 0-127 so no big deal on relating them.

>> OK - So I lied and this is the root of my question. The 50 remaining hex code values are in an alphanumeric format as in 4F or 5D or 6A and I’m not able to create rules based on that structure or am I? If there is a way to accomplish that task then all would be so simple. As of now the only way I can think of is to hard code the alphanumeric values into the output of the translator which does work but I would have to create 50 translators to accomplish the task as well as reading through them all to find the match.

>> As mentioned this only occurs at startup and storage but I would probably store them whenever changing tracks so I don’t think the overhead would create problems for a relatively new computer system.

What type of controller is this that you have? Do the knobs support push function? Are the knobs absolute values?If not, we might be able to reset them with your switch. I will need to take a look at the Logic manual to see if it supports a ‘center push’ function.

>> I believe that all of the above have been answer with the above replies and definitely with my long winded banter below

So much for being succinct…lol
IMPORTANT: THE YAMAHA 01X CONTROL SURFACE WORKS FLAWLESSLY WITH LOGIC. MY QUESTION IS WITH HANDLING HEX CODE WITHIN THE RULES SECTION OF A TRANSLATOR AS DOCUMENTED ABOVE!

HI Steve and thanks for being welcomed back. I do find it ironic that I used to contribute to the forum well over 15 years years ago when forums were still referred to as BBS’s. My focus was changed due to a relationship. When I got back into it, an upgrade caused a loss of all previous postings so I had to start from scratch again. Just FYI…
If I misled you regarding this issue I apologize but I do need to reinforce that my questions have nothing to do with the Yamaha 01x control surface. Yamaha had the wherewithal 21 years ago to include firmware for the popular DAW’s of the day. The 01x’s main function was to act as a total recording system based on Yamaha’s Studio Master software offering. Although they provided firmware for Logic, Cubase, Sonar and Digital Performer they gave up on their proprietary interface called mLan (firewire) due to lack of interest roughly 10 years later. Perhaps you may have been affected as well as they also based the Motif Keyboard system on mLan.

The rotary encoders function in a ‘relative’ method and also provide other functionality beside ‘pan’. They do reset Logics pan control back to center when pressed. The following is the midi data that will reset Logic’s pan controls back to center. I was able to extract the sysex data when sweeping the pan control from full left to full right and included the data below. You had mentioned the sysex data and I think you at one time said that you are knowledgeable with sysex. I was attempting to see if there was a pattern but it’s all way beyond pay grade. At the end of the sysex data below I’ve included the midi data that was generated by a sweep from left to right but was not able to get any result when piping in back into the interface.

So much for being succinct with my message but since I had already extracted the data I thought I’d send it along for craziness as my grandmother used to say…

This is where I’m losing you. I’m not sure what you mean about remaining 50 values. A MIDI controller can send 128 values (0-127) and -63 to +64 is also 128 values. Can’t you just store the position in this range and then offset it by a value of -63 in rules?

I think the procedure for putting the knob back to the original position is to:

  1. Send a message to Logic to center the V-POT
  2. Then send a separate message to send the relative value needed to put the V-POT in the correct position based on the stored value you had for that V-POT.

At that point the Logic should properly display the position.

Or am I missing some key point here. Maybe if you shared you spreadsheet on how you track the values that would help. You showed it in the video but I was unable to figure the logic you are using.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

I don’t see this.

There should’ve been 3 tables at the very end of the message. I copied them from a spreadsheet and pasted them into the email. On my end they were inserted as tables. I will also attempt to clarify what I was referring to regarding the hex values that update the pan knob position and display. Stay tuned.
I attempted to make it crystal clear but so much for that effort. I will also send you the spreadsheet that supports my rationale. There are 128 hex values that relate to the position of the knob and the data that it displays. Perhaps there’s even a finer set of values but I’m only using the values between 0 -127 in steps of one increment. Of the 128 hex values that came from Logic 80 of those values are a 2 character numeric value and the remaining 48 are an alphanumeric format. I was not able to reference the alphanumeric values in Rules due to their format as I guess as Rules threw an error when attempting to enter them. Is there a way that Rules will allow me to enter the alphanumeric hex values by preceding them with a ‘0x’ or some other prefix. That is the bone of contention or the root cause for my question. As mentioned I can enter the alphanumeric hex values in the output of the translator. I’ll send you the spreadsheet data next…

Sorry for the confusion that I’m causing…

Here is the table as well as a bitmap of the table just in case.

From UM-ONE | Track 1 | Note On | 1 | 90 20 7F |

  • | - | - | - | - |
    From UM-ONE | | Note On | 1 | 90 20 00 |
    From UM-ONE | Track 2 | Note On | 1 | 90 21 7F |
    From UM-ONE | | Note On | 1 | 90 21 00 |
    From UM-ONE | Track 3 | Note On | 1 | 90 22 7F |
    From UM-ONE | | Note On | 1 | 90 22 00 |
    From UM-ONE | Track 4 | Note On | 1 | 90 23 7F |
    From UM-ONE | | Note On | 1 | 90 23 00 |
    From UM-ONE | Track 5 | Note On | 1 | 90 24 7F |
    From UM-ONE | | Note On | 1 | 90 24 00 |
    From UM-ONE | Track 6 | Note On | 1 | 90 25 7F |
    From UM-ONE | | Note On | 1 | 90 25 00 |
    From UM-ONE | Track 7 | Note On | 1 | 90 26 7F |
    From UM-ONE | | Note On | 1 | 90 26 00 |
    From UM-ONE | Track 8 | Note On | 1 | 90 27 7F |
    From UM-ONE | | Note On | 1 | 90 27 00 |

During my preliminary investigation when sending positive hex values (+1 to +63) to the pan knob it displayed the position and value without any problem. I also determined that you could for instance send a value of +2 and then keep repeating that value until you hit the max of +63. When sending the knob a negative value of just -1 it immediately sent the knob to -64. You could however move the negative knob value up by sending it a value of +2. From that point I thought that I’d have to use something along that line to display for instance a -24 pan knob position and value. Upon further investigation it became apparent that each value from -64 to +63 was a unique hex value and was corroborated with the information that was being displayed in the MTP translator output stage window. This is starting to get painful. Please note that when I reference the decimal data stream of 0-127 that it’s still based on a hex data.

Let me send you the spreadsheet and hopefully that my clear things up for both of us…lol

You can determine the ascii hex, decimal or octal value of each single character be referring to this table. For each character, the value will be between 0 and 127 (0x7F). You can prepend 0x in rules as hex but when you read them back later in rules they will be shown in decimal format.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

Thanks for your help and patience Steve,
I did have a little scare though. I now can use the prepended hex values in Rules BUT when attempting to enter the prepended hex code (just as a test) in the output as in B0 10 0x4A I was again presented with an error message regarding the 0x4A value. I did discover that when using the Outgoing window for Control Change and selecting the related global variable it appeared to accept the global variable without complaining. For the most part I use the Raw Midi message method which also appears to be happy when entering its global variable. Am I correct in assuming that if I load a global variable that contains a prepended value using the Raw Midi method that the system will also convert the variable back to a non prepended format and go on its processing merry way?

In rules if you want to enter hex you enter them as 0x4a for example. For raw MIDI you need to enter them enter them just as 4A for example as raw MIDI always expects hex values. If you if you try to enter a decimal value it will just take it as a hex value so don’t do that. For instance 18 in RAW MIDI will be 24 in hex.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

Thanks for the update. Just one other confirmation regarding prepended hex in Rules.
If I update a global var in Rules as follows ‘if qq==10 then p1=0x4A’, the translator output of p1 will be 4A…correct?
The reason I ask is after finding out that rules can digest hex that has been prefixed with 0x, I then attempted to
enter the prepended value of 0x4A into the output and was presented with an error message even though the output
had no problem with the unprepended value of 4A. The output was able to digest the prepended value provided that
it was supplied by the specific method and not as raw midi. You know what…just do it and stop talking about it!
I also noticed that hex data negative hex data would work as long as it was in the 2’s complement format which again is
more that I need to know…

Thanks Steve

Only if qq equals 10. The decimal for 4A is 74.

Rules will not take a value like 4a for hex. It will have to be 0x4a. After saving the file if you go back to the rules it will change the 0x4a to 74

In contrast the raw output or raw input area needs to have 4a and will not take 0x4a

If you fill in an output value (not raw midi) with the value 0x4a it will take it or you can enter 75 and it will take that equally as well. Again if you enter it in hex, when you save the project file, it will convert it to decimal.

Yes, apparently it will take negative hex numbers but that always confuses me. I prefer to use decimal for negative numbers. Just the way my brain works.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

Hi Steve,
I believe that I have all the tools in order to wrap up the project and thanks for your input. This will be another project where the VS translator will shine.
I’ve included a link to a short video that documents the pan knob update function. I mention this towards the end of the video and to date I have never experienced this issue before. The list of commands that are in the translator are assembled with a spreadsheet and then pasted into the Rules window of the translator. I recall doing the pasting process several times as the prepended characters magically were stripped away from the hex value data and I thought that it was me. Is this something that is a known issue? The translator still works correctly???

https://storage.googleapis.com/midifiles/panKnobValues.mp4

It is not an issue, it is a feature.

In a nutshell, when you put something in a field that is invalid, the entry will turn red.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz

Yes, I’m aware of the red warning and/or error messages. In this case there is no warning as per MTP. It simply strips off the prepended data.
I seem to recall that the discussions and your instructions were all based on how to enter data into the Rules section.
Don’t worry about it as the system is working as required and I’m sure you’ve had your fill of my mindless banter…
Have a happy Independence Day and don’t blow off any fingers!