Skip to content

ohnoitsalobo/midi-lights

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

midi-lights

The original purpose of this code was simply to light an LED strip in response to MIDI received on the ESP8266 Serial port using this schematic and the FortySevenEffects MIDI library.

However, after discovering the Arduino AppleMIDI library, this functionality can be extended; the libraries can be used to send or receive MIDI over a MIDI connection or a wired / wireless network connection.
In my case, I can use it to turn my decades-old electric piano (Yamaha CLP-811) into a wireless MIDI keyboard if I so choose.
Caveats for wireless MIDI: there is noticeable latency and a strong possibility of missed notes. Do not use wireless network MIDI for anything mission-critical.

Required libraries:

Steps to use:

Install all required libraries.

Change board definitions in platformio.ini to reflect your board configuration.

Change WiFi network details in header.h

(In order to receive hardware MIDI, use the ESP8266 RX pin GPIO3 with the schematic linked above - or change the initialization in header.h to reflect whatever pin you're using)

Change LED output pin and NUM_LEDS in header.h (and other LED strip details if you're not using WS2812B)

Change some of the MIDI note details in MIDI.h if you are using a larger or a smaller keyboard, or sending a larger range of MIDI over the network.
The 61-key keyboard I have tested this on uses MIDI notes 36-96 for the full range. If the notes are transposed above or below that range, the LED strip adjusts to include them.

Upload to your device and it should work.

If network MIDI is enabled:

  • On Apple devices it may be automatically detected as a network MIDI device.
  • On Windows you will need to install rtpMidi.

Download the Virtuino Android app here for wireless control.
Open the file midi-lights.vrt6 in the Android app and change the IP address to whatever your ESP8266 or ESP32 IP address is.

Functions

  • Device starts up in 'automatic LED patterns' mode, but is listening for input from the MIDI port (either wired MIDI or network). If wired AND network MIDI is active, the controller only receives from the wired MIDI and mirrors it on the network (to avoid getting confused).

  • LED patterns will change every 60 seconds

  • If MIDI is detected, the LED strip lights up in approximate relation to the keys that were pressed. If no MIDI is detected for 10 seconds, the mode changes back to automatic patterns.

  • If the sustain pedal is used, it triggers a 'firework' effect on the LED strip.

  • BPM information can be calculated from MIDI data, to make time-responsive LED patterns.

  • Using the Virtuino app allows you to

    1. stop the auto-changing patterns on one that you like
    2. manually switch through patterns
    3. manually choose a solid color
  • Code can be updated wirelessly using ArduinoOTA and mDNS address (http://midi-lights.local instead of an IP address).
    mDNS requires Bonjour Print Services (also known as zeroconf) on to be installed on Windows

About

Code for my LED strip attached to a MIDI keyboard

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published