Midi Note Remapping / Midi Through


#1

I wanna make an object that takes a bunch of midi notes from my AKAI APC mini and remaps them so they work with my 1010music blackbox.

I did so going the patching route, but its quite inconvenient, cause I have to make it polyphonic, so I can press several buttons at once.

So the way to go is a custom object but I failed doing so at various attempts.

So I'm wondering if somebody has something like this ready maybe or tips on where to start?


#2

yes i made the remapaxis object, you should find it in the community repository. it does exactly what you asked for and should be easy to rewrite for your purpose.


#3

Hey thanks. I tried that object already but, patching is not really useful here because I need to nest it in a polyphonic subpatch and that blasts out a lot of resources.

So I would rather need it baked into a midi through object.


#4

Have you tried sss/midi/QuneoPoly4 ? You can have 4 midi note polyphony in a regular patch and then use the lokki object


#5

i see. so just use the midi thru object and in this section:


if(attr_input) {
uint8_t status_type = status & 0xF0;
if ((status_type == MIDI_CONTROL_CHANGE) ||
(status_type == MIDI_NOTE_OFF) ||
(status_type == MIDI_NOTE_ON) ||
(status_type == MIDI_POLY_PRESSURE) ||
(status_type == MIDI_PITCH_BEND)) {
MidiSend3((midi_device_t) attr_output,status,data1,data2);
flash_cnt = FLASH_LEN;
} else if ( (status_type == MIDI_PROGRAM_CHANGE) ||
(status_type == MIDI_CHANNEL_PRESSURE)) {
MidiSend2((midi_device_t) attr_output,status,data1);
flash_cnt = FLASH_LEN;
}
}

which is the MIDI Code

define an array of 128 bytes that contains your remapping, so position 0 would be what you want to be output when you press midi key 0 on the Akai APC and so on for all 128 (unless there is some fixed offset in which case it would be even simpler)

then you will have to rewrite the code a little to handle note on and off messages separately like so:


name_of_array[128] {put your values in here};

        if(attr_input) {
        uint8_t status_type = status & 0xF0;
            if ((status_type == MIDI_CONTROL_CHANGE) ||
           
                (status_type == MIDI_POLY_PRESSURE) ||
                (status_type == MIDI_PITCH_BEND)) {
                    MidiSend3((midi_device_t) attr_output,status,data1,data2);
                    flash_cnt = FLASH_LEN;
            } else if ((status_type == MIDI_NOTE_OFF) ||
                (status_type == MIDI_NOTE_ON)) {

MidiSend3((midi_device_t) attr_output,status,name_of_array[data1],data2);
flash_cnt = FLASH_LEN;
}else if ( (status_type == MIDI_PROGRAM_CHANGE) ||
(status_type == MIDI_CHANNEL_PRESSURE)) {
MidiSend2((midi_device_t) attr_output,status,data1);
flash_cnt = FLASH_LEN;
}
}

this is untested but should get you going. if it is a fixed offset you don't need the array, you can simply add the value to data1 in the note on and note off section above (the edited midi code i posted)


#6

Hey lokki, thanks a lot, this is exactly what I need!

tried to follow your instructions but I get this error when I press one of the midi notes:

So i defined my array in local data (it wouldnt compile if it was in the other sections:

const int myArray[128] = {0,1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
// etc, the changes happen from note 32 on, I defined it untill 67
};

and I changed the midi code according to your instructions:

if(attr_input) {
uint8_t status_type = status & 0xF0;
if ((status_type == MIDI_CONTROL_CHANGE) ||
(status_type == MIDI_NOTE_OFF) ||
(status_type == MIDI_NOTE_ON) ||
(status_type == MIDI_POLY_PRESSURE) ||
(status_type == MIDI_PITCH_BEND)) {
MidiSend3((midi_device_t) attr_output,status,myArray[data1],data2);
flash_cnt = FLASH_LEN;
}
else if ( (status_type == MIDI_PROGRAM_CHANGE) ||
(status_type == MIDI_CHANNEL_PRESSURE)) {
MidiSend2((midi_device_t) attr_output,status,data1);
flash_cnt = FLASH_LEN;
}
}
else if ((status == MIDI_TIMING_CLOCK) ||
(status == MIDI_START) ||
(status == MIDI_CONTINUE) ||
(status == MIDI_STOP)) {
MidiSend1((midi_device_t) attr_output,status);
}

dunno, can you see the error?


#7

i will have a look later, for starters, separate note on and offs from the rest of the midi messages, as i suggested in my pasted code. as you have it now you will also remap control changes etc...

also you want do define all 128 values of the array, even if you don't use the rest. if you ever plug in a keyboard and hit a higher key, you will run into troubles with your object


#8

try to define the array where status_type is defined in the midi code, also it should not be const int, just use uint8_t, but you can try with const uint8_t as well