apc40-mode: Change Firmware Modes On The Akai APC40

The Akai APC40 is a great controller for MIDI mapping to applications (Traktor, etc.) as it has a large and varied set of controls available, along with multi-coloured pads. For a MIDI application to take full advantage of these the APC40 needs to be in Firmware Mode 1; upon power-up, however, the APC40 enters Firmware Mode 0. Switching to Firmware Mode 1 can be done by opening Ableton Live, waiting for the APC40 to be recognised as a control surface (assuming it is configured as one), and then closing Live. apc40-mode is simple utility that will let you switch between the three firmware modes at the command line, so you don’t have to open Live (or even have it installed).

Akai APC40
Akai APC40

From the README file:

apc40-mode is a simple Java utility to switch between the three firmware modes of the Akai APC40 MIDI Controller, as described at http://www.akaipro.com/apc40map and in http://www.akaipro.com/extras/product/apc40/APC40_Communications_Protocol_rev_1.pdf

It is currently Mac OS X only, and because Apple's Java implementation is broken with some aspects of javax.sound.midi, it requires the mmj libraries found here - http://www.humatic.de/htools/mmj.htm

To install the mmj libraries, download the package from http://www.humatic.de/webapps/php/download/pick.php?app=mmj and unzip mmj.zip. Copy libmmj.jnilib and mmj.jar into /Library/Java/Extensions/ and you're done.

To build apc40-mode from scratch, simply use "javac APC40Mode.java". A class file is included, however, so this shouldn't be necessary.

To use apc40-mode, cd to the directory where APC40Mode.class is located and invoke it with "java APC40Mode mode".

mode can be 0, 1 or 2, corresponding to the following modes:

0 - Generic Mode
1 - Ableton Live Mode
2 - Alternate Ableton Live Mode

Note that upon power-up, the APC40 enters Generic Mode. If you open Ableton Live with the APC40 powered and connected, and wait until you see the "red square" around the clips in Live, the APC40 will enter Ableton Live Mode, and will remain in this mode when you quit Live. (This will only occur if the APC40 is configured as a control surface in Live's preferences).

The code is simple- find the APC40 device, and send it a small MIDI SysEx message.

import de.humatic.mmj.*;

public class APC40Mode
{
    private static final boolean DEBUG = true;
    private static final String APC40_NAME = "Akai APC40 - Akai APC40";
    private static byte mode = 0x00;

    public static void main (String[] args)
    {
        if ((args != null) && (args.length == 1))
        {
            if (args[0].equals("0")) { mode = 0x40; }
            else if (args[0].equals("1")) { mode = 0x41; }
            else if (args[0].equals("2")) { mode = 0x42; }
        }

        if (mode != 0x00)
        {
            byte[] introductionData = {(byte)0xf0, 0x47, 0x00, 0x73, 0x60, 0x00, 0x04, mode, 0x08, 0x04, 0x01, (byte)0xf7};

            MidiOutput midiOutput = getMidiOutput();

            if (midiOutput != null) { midiOutput.sendMidi(introductionData); }
            else { System.out.println("no APC40 found"); }
        }
        else { System.out.println("input error"); }
    }

    private static MidiOutput getMidiOutput()
    {
        MidiOutput midiOutput = null;   
        String[] midiOutputs = de.humatic.mmj.MidiSystem.getOutputs();

        if (DEBUG)
        {
            CoreMidiDevice[] coreMidiDevices = de.humatic.mmj.MidiSystem.getDevices();

            for (int i = 0; i < coreMidiDevices.length; i++)
            {
                CoreMidiDevice coreMidiDevice = coreMidiDevices[i];

                System.out.println(coreMidiDevice.getManufacturer());
                System.out.println(coreMidiDevice.getModel());
                System.out.println(coreMidiDevice.getName());
                System.out.println(coreMidiDevice.getID());
                System.out.println(coreMidiDevice.toString());
                System.out.println();
            }

            for (int i = 0; i < midiOutputs.length; i++)
            {
                System.out.println(midiOutputs[i]);
                System.out.println();
            }
        }

        for (int i = 0; i < midiOutputs.length; i++)
        {
            if (midiOutputs[i].equals(APC40_NAME))
            {
                if (DEBUG) { System.out.println("found APC40 at output " + i); }

                midiOutput = de.humatic.mmj.MidiSystem.openMidiOutput(i);
            }
        }

        return midiOutput;
    }
}

Note the TO-DO list:

  • Make this work on Windows & Linux by using standard javax.sound.midi, and let application auto-detect platform to choose which library to use
  • Test on APC20 (does it have different modes too?)
  • Add comments to the code
  • Add usage message to the code
  • Convert DEBUG flag to input argument
  • Package mmj libraries, binary and source into one jar
  • Create GUI wrapper

You can find the project on GitHub here: https://github.com/tunecrew/apc40-mode

10 Replies to “apc40-mode: Change Firmware Modes On The Akai APC40”

  1. Hi.

    I need some help, please.
    I’ve just got an used APC40. The buttons are ok, but all sliders and knobs doesn’t work. When I turn a virtual knob on Ableton Live, the knob lights respond to the movement with accurate range displaying. When I do the oposite (moving the APC40 knob) nothing happens (software parameters do not change).

    It was tested both on Mac and PC, with different USB cabbles and different power supply. It was also tested with ‘Midi-OX’ and ‘Midi Translator” softwares and the sliders and knobs still doesn’t work.

    Could they be disabled?
    Switching Mode would fix it?
    Anyone has passed throught this or something?

    Please, any hint would be good.

    Cheers.

  2. How does this work? I’ve downloaded it and the mmj library that it asks for. I’m not sure what you mean by “To use apc40-mode, cd to the directory where APC40Mode.class is located and invoke it with “java APC40Mode mode”.”
    Do I need to build it? Anyway you could break this down a bit simpler? I’ve been trying to work out how to change the mode on my APC40 mk2 for a couple of weeks now. I can’t figure out how to send the SysEx message via Sysex Librarian. Just getting frustrated and any help would be appreciated.

    1. Are you using Mac, Windows, Linux or other? Using this requires using the command line and I’ve only tested on it on Mac OS X to date. If you look at the GitHub link, I believe work is being done on Windows compatibility as well.

      Unfortunately I haven’t really looked back at this in a few years – going to try and make some time for it over the next month and will try and give a clearer explanation for persons who are not as computer savvy.

  3. In fact, that’s just an old procedure… Sysex messages!
    is this the message???

    F0 47 00 73 60 00 04 XX 08 04 01 F7
    XX is mode.

    1. yes it is – noted in the original post “The code is simple- find the APC40 device, and send it a small MIDI SysEx message”

      and yes that is the sysex message as seen in the code here:

      byte[] introductionData = {(byte)0xf0, 0x47, 0x00, 0x73, 0x60, 0x00, 0x04, mode, 0x08, 0x04, 0x01, (byte)0xf7};

Leave a Reply

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