MIDI library with incrementing method.

Hello,
I am looking some Arduino MIDI library that has method to increment/decrement value of CC. I am not even sure if it's possible. That's why I am asking.

Don't you know any library that allows to do such thing?

I've found nice MIDI library for Arduino FortySevenEffects/arduino_midi_library

And there is method:

void sendControlChange(DataByte inControlNumber, DataByte inControlValue, Channel inChannel);

But it allows you to set absolute value of CC. But I need to increment/decrement.

For any help great thanks in advance.

Best Regards

Unless you're using (N)RPN, MIDI does not really allow for increment/decrement messages. Many MIDI controllers just assign different meanings to the absolute CC values, e.g. a CC value of "1" means "+1" and a CC value of "127" means "-1". There are three main encodings in use. There is no way for the receiver to differentiate between actual absolute values and encoded relative increment/decrement messages, so the receiving software or hardware has to be configured correctly to interpret the messages as relative.

The Control Surface library I maintain has a [

RelativeCCSender

](Control Surface: RelativeCCSender Class Reference) class that allows you to easily send relative CC messages. It supports many different modes and encodings, see the documentation for [

relativeCCmode

](Control Surface: RelativeCCSender.hpp File Reference).

Given your post history about rotary encoders, you might be interested in the [

CCRotaryEncoder

](Control Surface: RotaryEncoder.ino) class that reads an encoder and sends the appropriate MIDI messages for you.

Pieter

Great thanks for your support. Your links look very interesting. I will follow them.
Thanks

I noticed when reading about MIDI that increment/decrement were all confused and mis-implemented,
so you're best not using them alas. What happens when a standard isn't crystal clear in its wording I
suspect.

Also not being idempotent they are less safe anyway in the face of lost messages, as you won't get
automatic self correction on the next relevant message for that control.

(Talking of safety, MIDI missed a trick with noteOn(), if it had been given a time-out and required
regular refreshing with aftertouch messages, you'd never get the problem of stuck notes when noteOff
messages were lost/garbled - perhaps this was seen as too complicated back in the day).