MIDI note range mapping

noob question! i am using MIDI note data to trigger different presets on a DMX light fixture. it works, but i have a range problem: there are 32 presets on my light fixture, and since DMX is 0-255, that means each one can be accessed with 8 different DMX values, ie. preset 1 is DMX values 1-8, second one is 9-16, and so on.

So how could i avoid triggering the same preset twice in a row, considering i often play adjacent notes (say 45, then 46, 47, etc.)?

i cannot think of a way to conveniently map my MIDI note output, which is 0-127 (even though i don’t use it all) to do that, so a cheeky way could perhaps be to store useful DMX values in an array:

int newarray[32] = { 1, 9, … };

and then spit those out one after the other in my DmxSimple.write message, the one going to channel 3 below?

if (channel==5){ // If the MIDI channel is 5 
      DmxSimple.write(1, 255); // set DMX channel 1 to ON
      DmxSimple.write(2, random(1, 255)); // set DMX channel 2 to some random colour 
      DmxSimple.write(3, XXXXXXX); // set DMX channel 3 to some preset shape...

digitalWrite(LED, HIGH); 
    
    }

no idea how to do that, of course, or if there is a better way around this. probably!
thanks!!!!

I'm confused. You have 127 note values and you want to "trigger one of 32 presets" when you play certain notes? For each of the 32 presets, which note triggers it?

If you want to avoid triggering the same preset more than once, store the number of the latest preset that was triggered and don't send a trigger if the new preset is the same as the latest preset.

You also have an issue where 8 consecutive DMX value will trigger the same 'preset'. The DMX value problem is easy: determine which preset you want to trigger and multiply that number by 8 (and add 1 if necessary).

I think i got what you mean, DMX is 8-bit, midi is 7-bit. I actually have a unit doing a midi to DMX converter, and one of the things i had to change was to use midi-cc instead of midi note (you have to keep pressing a note unless you want to receive a value of 0 (note-off == note-velocity 0) secondly if i want to translate a value (instead of say your random value) i simple multiply by 2 and lose resolution, or i use 2 cc's and add their value.
Mind you i actually use Ableton to send the midi or a midi mixer.
Also i found the dmxSimple library not nearly as good as the Conceptinetics (no lag..)
If you meant the amount of notes available, keep in mind that you do have 16 channels, not really sure if you can listen on the omni-channel and switch using the channel later using the standard midi.h ?