Mapping volume fader to javascript function

I would like extend my controller by 2 virtual decks.
According to
I guess I have to create a javascript function for all controls first.

How can I do this for my fourteen-bit-msb volume fader?

Can someone give me an example?

Hey @Aldous - if you check the mc7000 mapping you will find pitch fader and touch strip to be programed like you need in line 609 - 639.

Hope that helps.

Thanks for your fast answer.
But I am still confused.
If I look at my volume values they seem to be random even if I apply << 7.
How can I make sense out of it and use it?

Maybe you mixed msb and lsb. Can you paste the code you use from xml and js file so I can check? Please also give midi bytes info for both

You are right. I confused it with lsb. But still I don’t understand the difference.
This is the code from my XML file.

            <description>Deck 1: Volume Fader</description>

All I have in my js is

DDJ200.volume = function (channel, control, value, status, group) {
if (value === 0) { return; }
print(value << 7);

This is the output:
Debug [Controller]: DDJ-200: t:5128917 ms status 0xB0 (ch 1, opcode 0xB), ctrl 0x13, val 0x3E
Debug [Controller]: DDJ-200: t:5128917 ms status 0xB0 (ch 1, opcode 0xB), ctrl 0x33, val 0x2A
Debug [Controller]: 5376
Debug [Controller]: DDJ-200: t:5129091 ms status 0xB0 (ch 1, opcode 0xB), ctrl 0x13, val 0x3E
Warning [Controller]: MidiController: 14-bit MIDI mapping has mis-matched LSB/MSB options. Ignoring both messages.
Debug [Controller]: DDJ-200: t:5129091 ms status 0xB0 (ch 1, opcode 0xB), ctrl 0x33, val 0x5E
Debug [Controller]: 12032
Debug [Controller]: DDJ-200: t:5129121 ms status 0xB0 (ch 1, opcode 0xB), ctrl 0x13, val 0x3F
Debug [Controller]: DDJ-200: t:5129121 ms status 0xB0 (ch 1, opcode 0xB), ctrl 0x33, val 0x11
Debug [Controller]: 2176

I suggest to use Components JS, that will take care of the nasty details:

@hlzhs How? Can you give me an example?
I have no clue.

Have a look at the tempoFader example on the wiki section that I linked above.

Oh sorry, I didn’t know that was a link… :face_with_hand_over_mouth:
I will have a look!

I tried this

DDJ200.Deck = function (deckNumbers, midiChannel)
{, deckNumbers);
  this.volume = new components.Pot({
      midi: [0xB0 + midiChannel, 0x33],
              inKey: 'volume',

and receive this

Debug [Controller]: DDJ-200: t:81686 ms status 0xB0 (ch 1, opcode 0xB), ctrl 0x33, val 0x42
Warning [Controller]: ControllerEngine: “Uncaught exception at line 1 in passed code.\n\nException:\n TypeError: Result of expression ‘(DDJ200.leftDeck.volume)’ [[object Object]] is not a function.\n\nBacktrace:\n (arg1 = 0, arg2 = 51, arg3 = 66, arg4 = 176, arg5 = ‘[Channel1]’) at 1\n () at -1”
Debug [Controller]: MidiController: Invalid script function “DDJ200.leftDeck.volume”

@hlzhs - I think Frank get into same trouble as me when started the mapping. It is not really clear to beginners that traditional way and using Components JS are different approaches. And still I do not really understand the Components JS myself.

@Aldous - do you use the components based scripts? IMO, seeing the questions I doubt it. Is there a copy of your mapping available on github already?

I think it makes sense to check first with you what you program in which way. If you have started the traditional way then implementing the components based is not just a copy / paste exercise.

Anyway - I already see where you struggle within the xml and js file. If it turns out you use the traditional way of getting the script programmed I can help.

Sorry if that sounds confusing but for the moment I do not have a better answer. I’d like to see the 2 files completely first.

Ok, I have added my “4deck” files at

Please let me know if you see how to get the volume fader working in js.

I thought mapping the volume would be a very simple thing, but it seems like a big deal.
Does it really require Component JS?

I wont get it done today but i gonna send you a proposal soon. Have found the midi message documentation on the pioneer website so i have got all info. Cheers!

Edit: Actually it is not as difficult as you may think.

Thank you! Glad to hear!

@Aldous - I have sent you a pull request with changes to the left volume fader. Hope it works and you get the logic. You need to apply to the right side accordingly.

Great! It works! Thank you very much!
Also for your explanation.
Now I understand it.
It was very helpful and should go into the documentation.
Its is really missing there.

But now I am wondering if it is really worth while working with the additional LSB accuracy for the volume fader, since nobody will be able to tell a difference of more than 127 different values.
What do you think?

I am not sure on the volume faders either but for jog and pitch faders this 14bit resolution is a big improvement. I mean you could test for the right side if just using msb values would make a big difference to the left side.

The LSB only ever needs to be added on to the value of the MSB, and JavaScript’s 64-bit floating point Number type can reliably represent way bigger integers than you can fit in two bytes, so if you have the LSB, you may as well just add it on.