MIDI input / LED strip display timing issue

i have been playing with the same idea using shiftPWM and midi... i know there are probable more efficient ways of doing it but the best way i could get it to work was using a switch to handle the Midi on/off.

Im very much new to this Arduino stuffs but im hooked lol.

const int ShiftPWM_latchPin=8;
const bool ShiftPWM_invertOutputs = false; 
const bool ShiftPWM_balanceLoad = false;

#include <ShiftPWM.h>   // include ShiftPWM.h after setting the pins!
#include <MIDI.h>  // Add Midi Library

MIDI_CREATE_DEFAULT_INSTANCE();

unsigned char maxBrightness = 255;
unsigned char pwmFrequency = 75;
int numRegisters = 3;
int numRGBleds = numRegisters*8/3;
int note = 0;


void rgbLedRainbow(unsigned long cycleTime, int rainbowWidth);
void alternatingColors(void);
void hueShiftAll(void);

unsigned long startTime = 0; // start time for the chosen fading mode

void setup(){
  Serial.begin(9600);

  // Sets the number of 8-bit registers that are used.
  ShiftPWM.SetAmountOfRegisters(numRegisters);
  ShiftPWM.SetPinGrouping(8); 
  ShiftPWM.Start(pwmFrequency,maxBrightness);

  MIDI.begin(MIDI_CHANNEL_OMNI); // Initialize the Midi Library.
  // OMNI sets it to listen to all channels.. MIDI.begin(2) would set it 
  // to respond to notes on channel 2 only.
  MIDI.setHandleNoteOn(MyHandleNoteOn); // This is important!! This command
  // tells the Midi Library which function you want to call when a NOTE ON command
  // is received. In this case it's "MyHandleNoteOn".
  MIDI.setHandleNoteOff(MyHandleNoteOff); // This command tells the Midi Library 
  // to call "MyHandleNoteOff" when a NOTE OFF command is received.
}


void loop() { // Main loop
  MIDI.read(); // Continuously check if Midi data has been received.
}

void MyHandleNoteOn(byte channel, byte note, byte velocity) { 



switch (note){
  
  case 1:
  //ShiftPWM.SetAll(velocity*2);
    alternatingColors();
  break;
  case 3:
    rgbLedRainbow(3000,24);
  break;
  case 6:
  ShiftPWM.SetAllHSV(0, 255, velocity*2);
  break;
  case 8:
  ShiftPWM.SetAllHSV(240, 255, velocity*2);
  break;
  case 10:
  ShiftPWM.SetAllHSV(120, 255, velocity*2);
  break;
  case 13:
    hueShiftAll();
  break;



  case 0:
    ShiftPWM.SetHSV(0, 0,0, velocity*2);
  break;
  case 2:
    ShiftPWM.SetHSV(1, 0,0, velocity*2);
  break;
  case 4:
    ShiftPWM.SetHSV(2, 0,0, velocity*2);
  break;
  case 5:
    ShiftPWM.SetHSV(3, 0,0, velocity*2);
  break; 
  case 7:
    ShiftPWM.SetHSV(4, 0,0, velocity*2);
  break;
  case 9:
    ShiftPWM.SetHSV(5, 0,0, velocity*2);
  break;
  case 11:
    ShiftPWM.SetHSV(6, 0,0, velocity*2);
  break;
  case 12:
    ShiftPWM.SetHSV(7, 0,0, velocity*2);
  break; 
}
}
void MyHandleNoteOff(byte channel, byte note, byte velocity) { 



switch (note){
  
  case 1:
 
    ShiftPWM.SetAll(0);
 
  break;
  case 3:

    ShiftPWM.SetAll(0);

  break;
  case 6:

    ShiftPWM.SetAll(0);

  break;
  case 8:

    ShiftPWM.SetAll(0);

  break;
  case 10:

    ShiftPWM.SetAll(0);

  break;
  case 13:

    ShiftPWM.SetAll(0);

   break;  
////////////
case 0:
    ShiftPWM.SetHSV(0, 0,0,0);
  break;
  case 2:
    ShiftPWM.SetHSV(1, 0,0,0);
  break;
  case 4:
    ShiftPWM.SetHSV(2, 0,0,0);
  break;
  case 5:
    ShiftPWM.SetHSV(3, 0,0,0);
  break; 
  case 7:
    ShiftPWM.SetHSV(4, 0,0,0);
  break;
  case 9:
    ShiftPWM.SetHSV(5, 0,0,0);
  break;
  case 11:
    ShiftPWM.SetHSV(6, 0,0,0);
  break;
  case 12:
    ShiftPWM.SetHSV(7, 0,0,0);
  break; 
}

}

void hueShiftAll(void){  // Hue shift all LED's
  unsigned long cycleTime = 10000;
  unsigned long time = millis()-startTime;
  unsigned long hue = (360*time/cycleTime)%360;
  ShiftPWM.SetAllHSV(hue, 255, 255); 
}

void alternatingColors(void){ // Alternate LED's in 6 different colors
      unsigned long holdTime = 2;
      unsigned long time = millis()-startTime;
      unsigned long shift = (time/holdTime)%6;
      for(unsigned int ran=0; ran<numRGBleds; ran++){
        switch((ran+shift)%6){
        case 0:
          ShiftPWM.SetRGB(ran,255,0,0);    // red
          break;
        case 1:
          ShiftPWM.SetRGB(ran,0,255,0);    // green
          break;
        case 2:
          ShiftPWM.SetRGB(ran,0,0,255);    // blue
          break;
        case 3:
          ShiftPWM.SetRGB(ran,255,128,0);  // orange
          break;
        case 4:
          ShiftPWM.SetRGB(ran,0,255,255);  // turqoise
          break;
        case 5:
          ShiftPWM.SetRGB(ran,255,0,255);  // purple
          break;
        }
      }
    }
    
void rgbLedRainbow(unsigned long cycleTime, int rainbowWidth){
  // Displays a rainbow spread over a few LED's (numRGBLeds), which shifts in hue. 
  // The rainbow can be wider then the real number of LED's.
  unsigned long time = millis()-startTime;
  unsigned long colorShift = (360*time/cycleTime)%360; // this color shift is like the hue slider in Photoshop.

  for(unsigned int led=0;led<numRGBleds;led++){ // loop over all LED's
    int hue = ((led)*360/(rainbowWidth-1)+colorShift)%360; // Set hue from 0 to 360 from first to last led and shift the hue
    ShiftPWM.SetHSV(led, hue, 255, 255); // write the HSV values, with saturation and value at maximum

  }
  
}