KeyLED - music composition and improvisation aid
A DIY electronic device that illuminates the keys of any musical keyboard (scales, root note, and more!)
The Idea
My dad played classical guitar when I was growing up, so I never learned to play piano. I also never learned to play guitar, but it is the piano negligence I regret the most. In the following decades I have studied music theory and synthesis to obsessively analyze my favorite genre of music, but my lack of foundational keyboard-playing skills has been a constant thorn in my side. I want to improvise and make music with my synthesizers, but I don’t have the time or inclination to learn scales via discipline and practice.
What if there was a device that could highlight the keys within any arbitrary scale, identify the root note, and more? Enter the KeyLED.
The Tools
- Creality Ender-3
- 3ds Max
- Arduino Pro Micro
- WS2812B Individually Addressable Programmable RGB LED Strip
- DIYLC
The Process
My goal was to design and build a small electronic device (the KeyLED) that can be paired up with any musical keyboard to light up its keys in pre-programmed ways. I wanted the KeyLED to have a simple interface which can be used without disrupting the musical process, and I designed the lighting system to be adaptable for all possible keyboard configurations (full-size, slim, or mini keys, and keyboards ranging from 25 to 88 keys). From a software perspective, the KeyLED comes preloaded with all the information a musician might want during composition or improvisation.
My process was:
- Figure out what information to present to the musician
- Figure out a solution for lighting up arbitrary keys on any musical keyboard
- Design the electronics
- Design an enclosure
- Develop the software interface
1. What to Present to the Musician
When I’m making music, I start by deciding what scale I will be playing within. That’s where the problems begin: I don’t have an intuition for which notes/keys belong to my selected scale. The KeyLED should display at a minimum:
- the currently selected scale
- which keys belong to that scale
When improvising within a scale, the root note serves as the resolution point and is frequently returned to. The KeyLED should display:
- which key is the root note
And when developing a more complex melody, the intervals of the scale become important. The KeyLED should display:
- the intervals of the scale
2. Lighting up the Keys
The biggest design challenge was how to deal with the wide variety of keys found in musical keyboards:
Musical keyboards come in a variety of lengths:
If I were designing a solution for a single keyboard, I could have considered embedding individual LEDs into the keys, but I wanted a solution which is modular and can be used on any keyboard the user desires. LED strips came to the rescue, in particular the ubiquitous WS2812B Individually Addressable Programmable RGB LED Strip, commonly known as NeoPixel:
They are available in a variety of LED sizes (from 2020 [2.0 mm × 2.0 mm] up to 5050 [5.0 mm × 5.0 mm]), LED densities (from 30 LEDs/m up to 144 LEDs/m), and total strip lengths. The LEDs can be programmed individually, and the strips are cheap and easily sourced. Considering the possible key widths and keyboard lengths, I went with a 1m strip of 5050-sized LEDs, at the maximum density of 144 LEDs/m:
I needed a way to run this strip along the top of the keys. Referring to the Oxygen 61 MIDI Keyboard (a popular entry-level USB MIDI controller), there are gaps between the keys and the case:
I took advantage of this by designing a small plastic clip which slides into the gaps and holds the LED strip in place:
The clips are easily printed in bulk:
The clip holds the LED strip in place nicely without the use of adhesive:
On higher-end keyboards/synthesizers, these gaps are not present. Users have two options in this case:
- Affix the LED strip to the keyboard case using its adhesive backing for a more permanent solution.
- Tape the LED strip to the keyboard case for a temporary solution.
Here are the results when using the LED strip’s built-in adhesive backing on an ASM Hydrasynth:
Having solved the problem of interfacing with a musical keyboard, I moved on to the rest of the device.
3. Display, Control, and Electronics
For displaying information to the user, I used the ubiquitous backlit 1602 (16 characters, 2 lines) LCD display:
For user input, I used a rotary encoder knob with a push button:
The subtle detents of the rotary knob and the lack of a pre-determined “home” position should be very familiar to users experienced with modern synthesizer interfaces.
For a microcontroller, I went with the smallest Arduino clone - the Pro Micro (based on the ATmega32U4):
The circuit for the KeyLED is quite simple:
The rotary encoder is hooked up to two digital input pins for determining the rotation direction and amount, and the pushbutton is hooked up to its own I/O pin.
The LED strip receives power and a single-wire data line using the WS2812B one-wire data protocol to control individual LED brightness and color. For connecting the LED strip I used a 3-pin JST-SM connector:
The LCD display receives power, 4 data lines, and 2 control lines.
I threw together a quick protoboard using DIYLC:
After some soldering I had the electronics assembled in a reasonably small volume:
I next worked on an enclosure.
4. Enclosure
The display needs to be easily viewed by the musician, so I designed a tilt into the enclosure to maximize the LCD viewing angle.
I started by modelling the electronics:
I then designed an enclosure for a perfect fit:
The model was easily printed on an Ender-3:
Everything fits together nicely:
With the KeyLED assembled, I moved on to the software driving it.
5. Interface
I had 2 lines of 16 characters to work with on the LCD display. The most important thing to show the user was their selected scale and root note, so I dedicated the first line of the display to that.
Users only need to change two parameters under normal operation: the root note, and the scale. I handled this by using the rotary encoder pushbutton to switch between parameters, and using a visual indicator of which parameter is selected. Rotating the rotary encoder cycles through all the options.
The first 3 characters are dedicated to the root note, the 4th character is a space, and the remaining 12 characters are used for the name of the scale.
The following is the list of scales (and modes) included:
- Ionian / Major: Bright, used in popular music
- Dorian: Mellow, used in jazz and blues
- Phrygian: Exotic and tense, used in flamenco and metal
- Lydian: Dreamy and ethereal, used in jazz and cinematic music
- Mixolydian: Used in blues, rock, and folk
- Aeolian / Minor: Melancholic and dark, commonly used in Western music
- Locrian: Highly dissonant, rarely used
- Melodic Minor: Used in jazz
- Harmonic Minor: Exotic and tense, characteristic sound of Middle Eastern and gypsy music
- Major Pentatonic: Bright, commonly used in blues, rock, pop, and country
- Minor Pentatonic: Used in blues, rock, and jazz
- Whole Tone: Dreamy and surreal, used in impressionist music
- Augmented: Tense and unstable, used in jazz improvisation
- Chromatic: Used for tension or color
- Fully Diminished: Tense and eerie, used in jazz and modern classical music
- Dominant Diminished: Tense, used in jazz improvisation
- Half Diminished: A darker and unstable Locrian mode
- Phrygian Dominant / Gypsy: Exotic, used in flamenco, gypsy, metal, and goa trance
- Dorian #4: Exotic, used in modern jazz and fusion
Once a root note and a scale/mode are selected, the appropriate LEDs on the keyboard are lit in an intuitive way. Root notes are marked in green. To differentiate the naturals (white keys) from the accidentals (black keys), the black keys are marked in red. White keys are marked with white.
This arrangement is intuitive and unambiguous:
I had an additional 16 characters on the second row of the LCD display to convey additional information to the user. When composing or improvising, the musical impact of a series of notes often depends on the interval between them. Of particular importance is the interval between the note and the root note of the scale. I display these intervals to the user, using compact notation suited to the 16-character display:
- m2: Minor 2nd, 1 semitone
- M2: Major 2nd, 2 semitones
- m3: Minor 3rd, 3 semitones
- M3: Major 3rd, 4 semitones
- 4: Perfect 4th, 5 semitones
- tt: Tritone (augmented 4th/diminished 5th), 6 semitones
- 5: Perfect 5th, 7 semitones
- m6: Minor 6th, 8 semitones
- M6: Major 6th, 9 semitones
- m7: Minor 7th, 10 semitones
- M7: Major 7th, 11 semitones
The result:
Cycling through some scales:
5.1 Configuration
I wanted the KeyLED to work on any possible combination of key widths and keyboard lengths, so I needed to present the user with a simple way of configuring the KeyLED for their particular keyboard. This was accomplished with a configuration menu which is accessed by a long-press of the rotary encoder push-button.
It offers the following configuration parameters:
-
Number of keys: Total number of keys present on the keyboard
-
1st Note on Keyboard: The note name of the first key on the keyboard
-
LED Brightness: Brightness level for all illuminated LEDs
-
# LEDs total: Total number of LEDs in strip (multiple strips may be strung together to increase this beyond 144)
-
1st LED position: Moves the first LED position along the strip, to align with the first key on the keyboard
-
# LEDs per key: How many LEDs to assign to each key, allowing for any possible key width
-
Collapse LED?: If the LEDs and keys are not perfectly aligned, the error accumulates over time, and the LEDs will no longer line up with the keys beneath them. The LED strips themselves are made up of smaller interconnected strips soldered together, with a gap at the connection point.
This parameter “collapses” two LEDs into a single LED at the selected position, bringing the LEDs and keys back into alignment.
The configuration menu in use:
The Result
The KeyLED paired with an ASM Hydrasynth:
Playing around with scales, Vangelis-style:
All of the design files and other information needed to build your own KeyLED can be found here. Enjoy!