user76573: I'm trying to compile my code but i keep exceeding my global variable memory by 12%.
Is there anything i can do in my code to further reduce RAM usage?
Or do i have to do modifications to the libraries I'm using?
Here is my main program:
    #include <MIDI.h>
#include <FastLED.h>
#include <SoftwareSerial.h>

#define LED_PIN 3
#define NUM_LEDS 60
#define LEDMAP 0xAB5AB5AB5AB5AB5
#define OFFSET 36
#define RANGECHECK if (pitch > 35 && pitch < 96)

SoftwareSerial softSerial(2, 4);
CRGB leds[NUM_LEDS];

MIDI_CREATE_INSTANCE(SoftwareSerial, softSerial, midiB);

void setup() {
  FastLED.addLeds<WS2811, LED_PIN, GRB>(leds, NUM_LEDS);
  FastLED.clear(true);
  midiB.begin(MIDI_CHANNEL_OMNI);
  midiB.setHandleNoteOn(HandleOn);
  midiB.setHandleNoteOff(HandleOff);
}

void loop() {
  midiB.read();
}

void HandleOn(byte channel, byte pitch, byte velocity)
{
  RANGECHECK
  {
    leds[pitch - OFFSET] = bitRead(LEDMAP, (pitch - OFFSET)) ? CRGB::NavajoWhite : CRGB::Salmon;
    FastLED.show();
  }
}

void HandleOff(byte channel, byte pitch, byte velocity)
{
  RANGECHECK
  {
    leds[pitch - OFFSET] = CRGB::Black;
    FastLED.show();
  }
}

I've reached my limit in optimizing my RAM usage here. Any suggestions for optimizing my code would be appreciated.

user76573: Since i don't use sysex messages, i got my RAM usage down to 84% by setting the SysExMaxSize
in midi_settings.h
to 0.

user7859: FastLED needs to keep the colors of all the pixel in RAM, so that is using a lot of RAM.
To get around this, you could use a strategy that generates the pixel data on the fly as you send it out to the strings. Here is an example of a project that does that...
https://wp.josh.com/2021/04/21/build-a-live-scrolling-tickertape/
Also, SoftSerial keeps a buffer (looks like 64 bytes?) which also uses some RAM. You could use a different approach to serial communications that does not allocate such a large buffer. It would take work, but you could even process the midi bytes as they were received and not need any byte buffer.

76573: <p>I'm trying to compile my code but i keep exceeding my global variable memory by 12%.
Is there anything i can do in my code to further reduce RAM usage?
Or do i have to do modifications to the libraries I'm using?
Here is my main program:</p>
<pre><code>    #include &lt;MIDI.h&gt;
#include &lt;FastLED.h&gt;
#include &lt;SoftwareSerial.h&gt;

#define LED_PIN 3
#define NUM_LEDS 60
#define LEDMAP 0xAB5AB5AB5AB5AB5
#define OFFSET 36
#define RANGECHECK if (pitch &gt; 35 &amp;&amp; pitch &lt; 96)

SoftwareSerial softSerial(2, 4);
CRGB leds[NUM_LEDS];

MIDI_CREATE_INSTANCE(SoftwareSerial, softSerial, midiB);

void setup() {
  FastLED.addLeds&lt;WS2811, LED_PIN, GRB&gt;(leds, NUM_LEDS);
  FastLED.clear(true);
  midiB.begin(MIDI_CHANNEL_OMNI);
  midiB.setHandleNoteOn(HandleOn);
  midiB.setHandleNoteOff(HandleOff);
}

void loop() {
  midiB.read();
}

void HandleOn(byte channel, byte pitch, byte velocity)
{
  RANGECHECK
  {
    leds[pitch - OFFSET] = bitRead(LEDMAP, (pitch - OFFSET)) ? CRGB::NavajoWhite : CRGB::Salmon;
    FastLED.show();
  }
}

void HandleOff(byte channel, byte pitch, byte velocity)
{
  RANGECHECK
  {
    leds[pitch - OFFSET] = CRGB::Black;
    FastLED.show();
  }
}
</code></pre>
<p>I've reached my limit in optimizing my RAM usage here. Any suggestions for optimizing my code would be appreciated.</p>
 76573: <p>Since i don't use sysex messages, i got my RAM usage down to 84% by setting the <code>SysExMaxSize</code></p>
<p>in <code>midi_settings.h</code>
to 0.</p>
 7859: <p>FastLED needs to keep the colors of all the pixel in RAM, so that is using a lot of RAM.</p>
<p>To get around this, you could use a strategy that generates the pixel data on the fly as you send it out to the strings. Here is an example of a project that does that...</p>
<p><a href="https://wp.josh.com/2021/04/21/build-a-live-scrolling-tickertape/" rel="nofollow noreferrer">https://wp.josh.com/2021/04/21/build-a-live-scrolling-tickertape/</a></p>
<p>Also, SoftSerial keeps a buffer (<a href="https://github.com/arduino/ArduinoCore-avr/blob/master/libraries/SoftwareSerial/src/SoftwareSerial.h#L72" rel="nofollow noreferrer">looks like 64 bytes</a>?) which also uses some RAM. You could use a different approach to serial communications that does not allocate such a large buffer. It would take work, but you could even process the midi bytes as they were received and not need any byte buffer.</p>
