Note on/off to Midi CC (DDJ-400 --> Octatrack)

Hi,

I’ve been looking to map the mixer controls on my Pioneer DDJ-400 to control my Octatrack for external audio processing. It started out pretty straight forward mapping the track faders, gain, EQ and filter knobs as they were all CC —> CC conversions with some basic arithmetic.

But now I’m a bit stuck trying to map the channel cue buttons as the DDJ-400 outputs a momentary note on/off message, whereas the Octatrack is looking for a CC message (CC number 51, 0 for not cued, 1-127 for cued)

I’ve had a look through the forum and came across this: Note on/off to CC 0/127 toggle

But I don’t understand the logic to the responses. Specifically, what the bit-wise XOR (^) is accomplishing / why it’s necessary?

Full disclosure, I have next to no coding knowledge but I’ve read the manual and watched a couple YouTube tutorials on Bitwise operators which I understood but I don’t see how it applies to Midi Translator variables.

Perhaps just explaining how to arrive at the outcomes for the operator examples given in the manual for &, |, ^, >> and << might be all I need.

Also, the DDJ-400 has a light underneath the cue button which toggles on/off with each press so would there be a way to make sure it’s always in sync with the cue status within the Octatrack?

Apologies for all the questions, been scratching my head on this for a while.

Thanks,

Uzo

The XOR operator truth table is below

image

So essential if the 2 incoming bits are the same you get an output of 1
If the incoming bits are different you get an output of 0
If 1 of the incoming bits is 1 and the other is the current bit state, the new bit state will toggle.

Example. Say the global variable g0=0
If you do
ga=ga^1
then ga will be 1
if you do it again
ga=ga^1
then ga will be 0

The net effect is you are toggling the value of ga between 0 and 1

Keep in mind that global variables are 32 bit integers so in binary you are really toggling
only the first bit of 32 bits

Binary representation below

0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0001

So it is important that you start out with ga=0 otherwise you will get a different result

If you start out with ga being 2

Binary representation
0000 0000 0000 0000 0000 0000 0000 0010
then ga=ga^1 will product

0000 0000 0000 0000 0000 0000 0000 0011

or 3 decimal so you will be toggling between 2 and 3 instead of 0 and 1.

Why do you do this?

Say the button you are pushing is momentary and you want toggle behaviour

In momentary behavior when you push the button it will generally send Note On Note xx with velocity qq (where qq is typically a value of 127)

When you release the button it sends Note Off Note xx with velocity of qq (where qq can be anything but it is typically either 0 or 127).

In toggle behavior you want to push the button once for on and again for off and so on.

So the translator will be written as follows:

Incoming Note-On note xx any velocity

Rules:
// Note that when you start an MT project all global variables default to 0
// Toggle ga
ga=ga^1
// Set default output value
qq=0
// change it to 127
if ga==1 then qq=127

Outgoing Note-On note xx velocity qq

In most cases MIDI Note-on with velocity 0 also represents note-off

Now to send this to your application and to back to your controller, you can specify in the translator, or it’s parent preset where to receive input and send output.

For information on how to route to MIID devices you can review this tutorial.

Each button will need a different global variable so as not to interfere with other buttons.
However if you understand bitmapping you could use a single global variable and only toggle a given bit and control up to 32 button on/off states with a single global variable. I posted an example file that does just this using the APC-MINI. Just search for APC MINI and bitmap and if you can’t find it let me know. It is quite an advance project though so unless you are running short on global variables (there are 360 global variables available in MT Pro) it is probably simpler to use one global variable for each button than to go through a bitmapping exercise.

Steve Caldwell
Bome Customer Care


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

Awesome, exactly what I needed. Thanks for the thorough explanation and fast response Steve, appreciate it!

Looking forward to trying this out

For now I think using just a single global variable is a bit beyond my scope but I’ll keep that in mind for further down the line incase I get close to running out of the 360 global variables.

Thanks again!

Sounds good. Good luck!

Steve Caldwell
Bome Customer Care


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