Akai MPK261: One more thing using Sysex…

In a previous post, I explained how to control preset changes on the mPK261 using SysEx commands. In this post, I explain how to get the MPK2 series to show some tricked pad colors.

The key to changing the color of a specific pad is to send a MIDI SysEx. The format is

F0 47 00 25 31 00 04 01 0x yy zz F7

where x and y form the address, in hexadecimal, of a specific pad in the MPK RAM memory and zz is the color number, from 0x00 to 0x0B. The x and y components of the address is a bit tricky because since you are sending a SysEx to a MIDI device, no byte can have a value greater than 0x7F, otherwise bit 1 is set and that breaks the SysEx stream. So the addresses for the pads are 0x0A7C and up: 7C, 7D, 7E, 7F and the next one is 0x0B00, and so on to oxoB0B.

For this to work, you need to write/modify some code. It’s doable with Processing and some DAW (but not Ableton!) might let you send SysEx on demand. You could also use an Arduino, like I did here.

The Arduino receives all MIDI message from the keyboard and will search for some commands, mainly Control Change or Note On. Receiving the proper command (in these examples by pressing a specific button) will launch code that will send a series of MIDI SysEx messages to the keyboard, forcing specific pads to show a certain color or just turn off.

Here’s a bit of (Arduino) code that has two loops; one to address the first four pads, then the next 12 and send the color 0x00, or black:

[language=”++”]

void loadDarkPads() {
  byte a;
  // first row of pads is 0X0A7C to 0X0A7F
  MPK2PadsSysEx [8] = 0x0A; //pad address is 2 bytes. First one is 0x0A or 0x0B
  for ( a = 0x7C ; a <= 0X7F ; a++) { //second byte varies depending on first byte
    MPK2PadsSysEx [9] = a; //Which pad
    MPK2PadsSysEx [10] = 0; //What color (here Dark)
    midiA.sendSysEx( MPK2PadsSysExLength, MPK2PadsSysEx, true);
  }
  // second to fourth row of pad is 0X0B00 to 0X0B0B
  MPK2PadsSysEx [8] = 0x0B;
  for ( a = 0x00 ; a <= 0x0B ; a++) {
    MPK2PadsSysEx [9] = a;
    MPK2PadsSysEx [10] = 0;
    midiA.sendSysEx( MPK2PadsSysExLength, MPK2PadsSysEx, true);
  }
}

[/++]

This is the complete code for the Arduino.

MP-4_001_MPK2_pads_clean.ino


Comments

14 responses to “Akai MPK261: One more thing using Sysex…”

  1. ToneCre8 Avatar
    ToneCre8

    rt,

    Thanks for these very helpful articles on the MPK! This information has aided me in my custom script for Bitwig using the MPK2.
    I was wondering if you could help me figure out how to write to the display of the MPK2? I was able to accidentally at one point but for the life of me can’t figure out how I accomplished that! Shame to leave all those crystals unused. 🙂

    Thanks again!

    1. Thanks for the comment.

      Writing on the display is very easy to do if you load a Preset, of course. I haven’t found the exact address to write directly on the display “live”. I’ll take a closer look and share.

    2. Nick Avatar
      Nick

      Hi,

      I’ve been looking into this as well, and did find a way to modify the name of the currently loaded preset:
      f0 47 00 25 31 00 0b 08 00 00 61 73 64 66 30 31 32 33 f7
      will set the name on screen to “asdf0123”
      Sadly this only gives you access to the 8 character preset name on the screen.

      As an aside, it seems for my controller, the pad change command is 31 rather than 30, not sure why it would be different.

      1. You’re right about the “31”. It’s correct in the Arduino code that I provided. I’ll modify the post
        Thanks for the display address. I’ll look into it.
        I’m writing a Processing program that will dump RAM segments. We should be able to map most parameters eventually.

  2. Pavel Trnavsky Avatar
    Pavel Trnavsky

    Hi…for some mysterious reason and after a lot of headache I have discovered that dumped presets by SYSEX (back to MPK249) will only will show after I switch off and on MPK249. Any ideas?

  3. Luke Avatar
    Luke

    Hello! Thanks for this and the other post about the MPK sysex commands. They’ve been super helpful!

    I was curious about your approach for discovering this. Was it just guess and check, or is there some documentation I should be using for this? The part of the command that is “31 00 04 01” is the main confusing part. Thanks!

    1. I used another software to see what midi commands were sent to the MPC software that came with the keyboard. Kind of hacking, in some way. That gave me the “31 00 04 01” sequence, amongst other things. There was also quite a bit of trial and error!
      I’ve been working with Midi a long time, so your mileage may vary!

  4. Sylvester Rodriguez Avatar
    Sylvester Rodriguez

    Can this work on other DAW like fl studio

    1. As long as fl studio can send Sysex messages, it should be OK.

  5. It appears that this is a way to write arbitrary messages to the screen.

    header = 0xF0, 0x47, 0x00, 0x24
    footer = 0xF7
    message = 0x01, 0x00, [length], [byte message of length]

    But the screen freezes and you can no longer get out, although the systems still seems to accept commands. Any help from other MPK hackers appreciated.

  6. Toaster1974 Avatar
    Toaster1974

    Hi. Thanks for the video! I was wondering, is there a way to send sysex to the mpk2 to turn the s1-s8 lights on or off? I’ve got the pads working beautifully, I can switch them on and off and choose the colour by sending sysex from my VST host (cantabile) but trying trial and error to.find the address and on/off code for s1-s8 lights is almost impossible, and Ive tried to use the patch dump to compare but as far as I can work out, the patches don’t save the state of those lights…
    Cheers
    P

    (Apologies, I posted this question on the other post you made about MPK sysex…)

  7. Hello,
    Is there a way to externally (on laptop) save a custom MPK249 Program I made, say via USB, in order to Load it onto a different MPK249?
    Apologies if this is unclear, and thanks for considering!

  8. dr_infantil Avatar
    dr_infantil

    If you go to “Global”, you can send the program via SysEx. You can save the SysEx data via midi-ox for example and send it back to another device. I guess this should work (but I haven’t tried).

    Does anyone have found the “communication protocol” for MPK249 / MPK261 ?
    Guessing the commands is not very straight forward. Still struggling with setting the “On” color for the pads, but with no success so far.

  9. GitHub.com/open labe/openklave

Leave a Reply

Your email address will not be published. Required fields are marked *