     fft_mag_lin();                 // take the output of the fft
 }
 
-// Fill the dots progressively along the strip
-void setColor(uint32_t c) {
+// Set color based on frequency and brightness
+void setColor(int peak_index, int brightness) {
+    
+    if (peak_index == 0) {
+        strip_color = strip.Color(0, 0, 0);
+    } else if (peak_index > 24) {
+        strip_color = strip.Color(
+            round(color_palette[23].red   * brightness),
+            round(color_palette[23].green * brightness),
+            round(color_palette[23].blue  * brightness)
+        );
+    } else {
+        strip_color = strip.Color(
+            round(color_palette[peak_index - 1].red   * brightness),
+            round(color_palette[peak_index - 1].green * brightness),
+            round(color_palette[peak_index - 1].blue  * brightness)
+        );
+    }
+    
     for (int i=0; i < strip.numPixels(); i++) {
-        strip.setPixelColor(i, c);
+        strip.setPixelColor(i, strip_color);
     }
     strip.show();
 }

// are 32 LEDs per meter but you can extend or cut the strip.  Next two
// parameters are SPI data and clock pins:
LPD8806 strip = LPD8806(nLEDs, dataPin, clockPin);

void setup() {
    if (DEBUG) {
        Serial.begin(9600);
    }

        brightness = 127;
    }
    
    // Set frequency to zero if signal is weak or if the 1st peak (0Hz) is dominant
    if (max_value < 60 || sum_fft < MIN_FFT_SUM || peak_index == 0) {
        // signal too weak or we got the 1st peak (0Hz), no lights
        peak_index = 0;        
    }
    
    setColor(peak_index, brightness);
            
    if (DEBUG) {
        frequency = (peak_index * (SAMPLE_RATE / SKIP_MULT)) / (FFT_N / 4);
        
        Serial.print("FFT sum: ");
        Serial.print(sum_fft);
        Serial.print("\tPeak index: ");
