I made some Piano scale guide scripts

Something I’ve been meaning to do for a long time is to create a multi-purpose light guide for highlighting the notes on a keyboard for a given scale or mode. The Native Instruments Komplete Kontrol keyboards have this functionality, there are rather expensive aftermarket tools and some homebrew projects like the PianoLux, but these tend to be more focussed on keypress responsivity or follow along song, guidance.

I’ve found a 72led/m strip will perfectly map along a full sized keyboard - but that measurement is pretty important. I ordered a 72 last wee and a 70/m turned up - no good. It’s not the most common count around but its attainable.

It’s quite possible that these scripts could be optimised, but they are doing the job for me just fine - I’ve put some examples and a couple photos below.

If there’s an interest, I can upload all thirteen scales and modes to the public library.


// Pixelblaze Script: Piano Keyboard Scale Highlighter - Minor Pentatonic Scale 
//   Allowed intervals: 0, 3, 5, 7, 10.
// Assumptions:
//   - One LED per semitone along a piano keyboard. 72led/m full size.
//   - The first LED's note is defined by 'startingNote'.
//   - The root note of the scale is defined by 'rootNote'
// Exported parameters (use sliders in the Pixelblaze UI):
//   startingNote:    Numeric note for LED 1 (use mapping above)
//   rootNote:        Numeric root note of the scale (use mapping above)
//   rootColorHue:    Hue for the root note LED (0 to 1)
//   otherColorHue:   Hue for all other scale notes (0 to 1)
//   rootBrightness:  Brightness for the root note (0 to 1)
//   otherBrightness: Brightness for other scale notes (0 to 1)

/*
  Note-to-number mapping:
    0 = C
    1 = C#/Db
    2 = D
    3 = D#/Eb
    4 = E
    5 = F
    6 = F#/Gb
    7 = G
    8 = G#/Ab
    9 = A
   10 = A#/Bb
   11 = B
*/


export var startingNote = 9; // e.g., 0 = C
export var rootNote = 0;     // e.g., 0 = C
export var rootColorHue = 0.0;  // e.g., 0.0 = red
export var otherColorHue = 0.06; // e.g., 0.8 = a different color
export var rootBrightness = 0.5;
export var otherBrightness = 0.1;

export function isInScale(note) {
  var diff = (note - rootNote + 12) % 12;
  return (diff == 0 || diff == 3 || diff == 5 || diff == 7 || diff == 10);
}

export function render(index) {
  var note = (startingNote + index) % 12;
  if (isInScale(note)) {
    if (((note - rootNote + 12) % 12) == 0)
      hsv(rootColorHue, 1, rootBrightness);
    else
      hsv(otherColorHue, 1, otherBrightness);
  } else {
    hsv(0, 0, 0);
  }
}


4 Likes

Really cool, thanks for sharing!

Next up 10 strips and you have a player piano / rockband setup!