Arduino Controller - Rotary encoders jumping around

ralphonz

Inspired
Hi All,

I'm a total novice when it comes to this but hopefully someone with a little more experience can help me out?

I'm building a small MIDI controller to use with my Axe FX II. It's four endless rotary encoders (pulled from a BCR2000) connected to an arduino uno. It transmits midi on 5-pin din not USB.

I have the encoders working great with ableton live and logic pro using a usb MIDI interface so I know they work fine, every thing is wired correctly etc.

The rotaries are programmed to transmit midi CC's #24, #25, #26 and #27 which correspond to external controllers 9-12 on the axe fx.

So, I connect the controller to my axe fx MIDI in port and assign the external controllers to a parameter. However, when I turn the rotaries the parameters jump around wildly and do not control the axe fx in any usable way. This does not happen with a DAW.

I feel like the problem is related to the relative encoder mode as changing this waters the behaviour of the control on the axe fx but I don't know the correct one to use. I've tried them all but none result in smooth or correct control.

I'm using the MIDI control surface library in arduino and have choice of the following relative rotary modes, but which one (if any) will work with the Axe FX?

TWOS_COMPLEMENT
BINARY_OFFSET
SIGN_MAGNITUDE
NEXT_ADDRESS
 
I don't use encoders on my midi controller, only potentiometers, so I cannot really help you. But what's good to know in order to help you is the actual code you are using.

About those modes, can't you just try them all an then see which one works? (again, I've never programmed for encoders, but I'd just do that and try them)
 
I don't use encoders on my midi controller, only potentiometers, so I cannot really help you. But what's good to know in order to help you is the actual code you are using.

About those modes, can't you just try them all an then see which one works? (again, I've never programmed for encoders, but I'd just do that and try them)

Of course! Here it is, pretty simple stuff:

Code:
#include <Encoder.h>
// Encoder must be included before Control Surface

//Include the MIDI control surface library
#include <Control_Surface.h>

// Instantiate a Serial MIDI interface that will be used by Control Surface
HardwareSerialMIDI_Interface midi = {Serial, MIDI_BAUD};

// Instantiate a CCRotaryEncoder object                                                                                
CCRotaryEncoder encoders[] = {
  { {2, 3}, 24, 1, 4},
  { {4, 5}, 25, 1, 4},
  { {6, 7}, 26, 1, 4},
  { {8, 9}, 27, 1, 4},
};

void setup() {
  // Select the correct relative MIDI CC mode.
  // Options:
  //   - TWOS_COMPLEMENT (default)
  //   - BINARY_OFFSET
  //   - SIGN_MAGNITUDE
  //   - NEXT_ADDRESS
  // Aliases:
  //   - REAPER_RELATIVE_1
  //   - REAPER_RELATIVE_2
  //   - REAPER_RELATIVE_3
  //   - TRACKTION_RELATIVE
  //   - MACKIE_CONTROL_RELATIVE
  //   - KORG_KONTROL_INC_DEC_1

  //RelativeCCSender::setMode(relativeCCmode::SIGN_MAGNITUDE);
  Control_Surface.begin(); // Initialize Control Surface
}

void loop() {
  Control_Surface.loop(); // Update the Control Surface
}
 
Last edited:
Back
Top Bottom