Overlapping arguments with neopixels?

I'm trying to set up some code so that I can use MIDI to control my neopixels. Everything is mostly working, I can pull up ableton and program in some MIDI notes and the lights light up! (Which is very cool), the problem I am having is that I can only light up 1 LED at a time. That is, I can only have red, or green, or blue. No combinations of any of them.

So what happens is that if I hit note 60, it sends the signal (20, 0, 0) and if I hit note 61 it sends the signal (0, 20, 0) but if I hit notes 60, and 61 at the same time, the result I want is (20, 20, 0) but the actual result is just (20, 0, 0) as I believe I'm sending conflicting arguments to the same pixel.

Here is the relevant piece of code

void OnNoteOn(byte channel, byte note, byte velocity)
{
  uint8_t red = 0;
  uint8_t green = 0;
  uint8_t blue = 0;

  if (note == 63)
  {
    digitalWrite(ledPin, HIGH);
  }
  else
  {
    if (note == 60)
    {
      red = 20;
    }
    if (note == 61)
    {
      green = 20;
    }
    if (note == 62)
    {
      blue = 20;
    }
    strip.setPixelColor(1, red, green, blue);

  }
}
  void OnNoteOff(byte channel, byte note, byte velocity)
  {
    uint8_t red = 0;
    uint8_t green = 0;
    uint8_t blue = 0;

    if (note == 63)
    {
      digitalWrite(ledPin, LOW);
    }
    else
    {
      if (note == 60)
      {
        red = 0;
      }
      if (note == 61)
      {
        green = 0;
      }
      if (note == 62)
      {
        blue = 0;
      }
      strip.setPixelColor(1, red, green, blue);

    }
  }

Any help resolving this, or pointing me in the right direction is much appreciated! I tried messing around with some strip.getPixelColor arguments, but I couldn't get it to work :/

Your OnNoteOn method only sets either red, green or blue to 20 - it can never set more than one of the variables to 20 at the same time.

    if (note == 60)
    {
      red = 20;
    }
    if (note == 61)
    {
      green = 20;
    }
    if (note == 62)
    {
      blue = 20;
    }

The parameter note can't equal 60 and 61 at the same time. The LED strips aren't cumulative - you have to write out the whole strip at once and then change the whole strip when you want something different.

I'm not familar with midi, but it sounds like you need to pass in an array of all of the notes that are pressed down so that you can decide how to colour the LED.

Do you have more than one LED in the strip?

Yes I have 4 LED's in the strip. I see what you are saying how the code is written out. What I posted originally is some code that was given to me by adafruit support. My original code was this

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

  if (note == 60) {strip.setPixelColor(1, 255, 0, 0);} else
  if (note == 61) {strip.setPixelColor(1, 0, 255, 0);} else
  if (note == 62) {strip.setPixelColor(1, 0, 0, 255);} else
  if (note == 64) {strip.setPixelColor(2, 255, 0, 0);} else
  if (note == 65) {strip.setPixelColor(2, 0, 255, 0);} else
  if (note == 66) {strip.setPixelColor(2, 0, 0, 255);} else
if (note == 63) {digitalWrite(ledPin, HIGH);}
}

void OnNoteOff(byte channel, byte note, byte velocity)
{
  if (note == 60) {strip.setPixelColor(1, 0, 0, 0);} else
  if (note == 61) {strip.setPixelColor(1, 0, 0, 0);} else
  if (note == 62) {strip.setPixelColor(1, 0, 0, 0);} else
    if (note == 64) {strip.setPixelColor(2, 0, 0, 0);} else
  if (note == 65) {strip.setPixelColor(2, 0, 0, 0);} else
  if (note == 66) {strip.setPixelColor(2, 0, 0, 0);} else
  if (note == 63) {digitalWrite(ledPin, LOW);}
}

When it's formatted this way, I am able to light up multiple LED's at the same time exactly how I want, but not multiple colors within the same LED, because I'm effectively sending the signal of (1,255,0,0) and (1,0,255,0) at the same time, and the LED can't be 255 AND 0 at the same time, so it's just a different problem this way. So it is possible to light up more than 1 LED at a time, the issue comes from wanting to use more than 1 RGB value at a time. I want the RGB values to be variable essentially, based on note velocity.

I hadn't thought of using an array as I'm not very experienced so I haven't had a reason to use one yet, but based on what you told me, I will look into them and see how useful they would be for my project.

EDIT:

Just got some working code!! it's working now.

it was a matter of making the variables global instead of local by placing them above the OnNoteOn command like this

uint8_t red = 0; uint8_t green = 0; uint8_t blue = 0;

void OnNoteOff(byte channel, byte note, byte velocity)

Now I can get orange, purple, white. So cool!!