Code Monkey home page Code Monkey logo

piano-led-visualizer's Introduction

Piano LED Visualizer

contributions welcome

Everything Is AWESOME

The Piano LED Visualizer is a project that enables you to connect an LED strip to your Raspberry Pi and enhance your piano playing with captivating visual effects. This repository provides detailed instructions on how to set up the LED strip, connect it to a digital piano, and synchronize the lighting with your playing. Additionally, it offers integration with external software such as Synthesia for an enhanced learning experience.

Features

  • Visual Effects: Acts as a sound visualizer, making your piano playing look cool with lights that react to your music.

  • Learning: Lights above the keys show you which ones to play, helping you learn piano.

  • MIDI Integration: Supports external software like Synthesia for lighting next-to-play keys.

  • Customizable Lights: You can change the colors and brightness of the lights to fit your style.

  • Record and Play: Record your piano songs, download them or play directly from Visualizer.

  • MIDI Files: Load MIDI files to see which keys to play, making it easy to learn new songs.

  • Light Sequences: Create sequences to switch between different light settings during your performance.

  • Web Control: Use a simple web interface to set up and control the lights.

  • Optional Hat Extension: There's an extra hat with buttons and a screen for easier control, making it a standalone device.

  • Cool Animations: Enjoy light animations to add atmosphere to your music.

What you need:

Make sure the power supply is 5V (5 Volt). using power supply with more Volt WILL damage both LED strip and Raspberry Pi.

Not required but worth having, to make everything look neat:

  • Custom 3d printed case (I attached STL file with modified 3d model, there is additional space and holes for power socket and wires, here is original model). Optionally you can use models without a holes for screen, hdmi and sd port, provided by fermaton
  • Nylon standoffs M2.5 10mm Amazon US | Aliexpress
  • Screws M2.5 10mm Amazon US | Aliexpress
  • Waveshare LCD TFT 1,44'' 128x128px Amazon US | Aliexpress
  • Braid for cables Amazon US | Aliexpress
  • Heat shrink bands Amazon US | Aliexpress
  • Aluminium LED Profile with diffuser (highly recommend to search for the right one in local shops) pic#1 pic#2 Alternative made of silica gel: Aliexpress (choose T0515 for 12mm 2 meters, credits to vzoltan for finding this)
  • Double side tape to stick everything on the piano
  • Windows 10 laptop/tablet with bluetooth to run Synthesia
  • magnetic or mechanical switch to detect if the keyboard cover is opened or closed, if your piano has one (see Instructions)

For items like screws, standoffs, and wires, look at local hardware stores to avoid buying in bulk.

Total cost (excluding piano and tablet) should be 75-100 USD Disclosure: All of the links above are affiliate links, which means that without additional costs for you, I will earn a commission if you make a purchase by clicking through it.

Software preparations

There are two ways, you can use preconfigured system image or install everything manually.

1. System image

  • Download the latest zip file from releases.
  • Unzip the file.
  • Use program like Win32 Disk Imager or Etcher to save system image to your SD card (4GB is a minimum).

If you don't need to connect your RPi to Wi-Fi you can eject SD card from your PC and put it in Raspberry Pi. After 3-8 minutes (depending on how fast your SD card is) you should see Visualizer menu on RPi screen.

For version 1.5 and above:

The Raspberry Pi sets up a Wi-Fi hotspot named 'PianoLEDVisualizer' with the password 'visualizer'. Once connected, open your browser and go to "pianoledvisualizer.local" to access the web interface. Use the "Network" tab there to link the Raspberry Pi to your regular network.

You can also connect Raspberry Pi to your network manually

2. Manual installation

Instructions

Connecting LED Strip to Raspberry Pi and enabling SPI

There is no point to reinvent the wheel again, here is a nice tutorial (do only the hardware part). Double check how your LED strip is wired. Most strips use G-D-V (ground, data, voltage), however in the wiring diagram shown in the tutorial the voltage and data lines are swapped. Connecting voltage directly to your data pin might seriously damage or kill your Raspberry!

Optionally, you can connect a switch to BCM pin 12 and GND. Attach the switch to the key cover, if available. When it is closed, the animations are automatically switched off.

If you are wondering how to connect wires to RPI if screen hat is taking all pins here is a picture of how I did it. There should be a gap between RPI and screen so you can solder your wires or just wrap cables around the pins and separate them with heat shrink bands.

After connecting all cables as described above everything should fit nicely to case. Scroll down to see some photos of the setup I made If you don't have a 3d printer, try to find some company or private person who will print it for you. I paid 12USD for my print. RPICaseModel.stl

Web interface

The visualizer comes with a web interface with which you can control the colors of the LED strip, change port settings, run animations of the strip, control sequences and manage midi files, including downloading, uploading, renaming, deleting, and playing. To connect to the web interface, type the local address of your raspberry pi in the browser, for example http:/192.168.1.10 Both devices must be connected to the same network. By default, web interface works on port 80, but if needed it can be changed with the script's argument --port

sudo python3 /home/Piano-LED-Visualizer/visualizer.py --port 5000

Although in my tests I did not notice any deterioration in performance, if necessary, you can disable the web interface with the --webinterface parameter

sudo python3 /home/Piano-LED-Visualizer/visualizer.py --webinterface false

FAQ

Q - Can I use Raspberry Pi 1/2/3/4 instead of Zero?

  • In theory, yes. In practice many users reported problems with huge delay between key presses and lights reacting to it on Raspberrys other than Zero.

Q - What about Raspberry Pi Zero without Wi-Fi and bluetooth?

  • If you are going only for the visuals and do not plan to use it with Synthesia you can save some bucks and buy cheaper, non-WH version of Zero. Notice, that you won't be able to use web interface

Q - Can I use other screens or no screen at all?

  • Currently, the only other supported screen is Waveshare LCD TFT 1,3". As for no screen, you can instead use web interface.

Q - Does the color of LED strip PCB matter?

  • No, it's only visuals.

Q - Can I use other led strip?

  • Only WS281X led strips are supported

Q - Do I need power supply for LED strip?

  • RPi alone should be fine powering up to 10 LEDs at the same time, although I do not recommend it.

Q - Do I need soldering skills to make it?

  • Users reported that LED strips bought on Amazon are shipped in one meter strips, in that case you would need to solder them. I bought mine on Aliexpress and it was 2 meters long strip in one piece. As for connecting wires to RPi, I just wrapped them around pins and tightened it with heat shrink bands.

Q - How do I access recorded files?

  • If you connected your RPi to Wi-Fi you can use SFTP or web interface to transfer files.

For web interface: Open internet browser on device connected to the same network and type RPi's local address pianoledvisualizer.local Then from the menu on the left choose "songs management" tab.

For SFTP: in any FTP program (like Filezilla) connect to your RPi local address (for example: sftp://192.168.1.10) and navigate to /home/Piano-LED-Visualizer/Songs.

Q - How do I update visualizer?

  • A - From the Visualiser menu Other Settings > Update visualizer > Confirm.

After the update, a reboot is required.

  • B - Connect to your console using SSH and type:

cd /home/Piano-LED-Visualizer and then

git pull origin master

If for some reasons it does not work try to remove whole project and clone it again.

cd /home

sudo rm -rf Piano-LED-Visualizer

sudo git clone https://github.com/onlaj/Piano-LED-Visualizer

Image Image Image

sidebar homepage changing led colors ports settings songs_management

Image Image Image Image Image

piano-led-visualizer's People

Contributors

abrahamwisman avatar critox42 avatar devscyu avatar eferu avatar ericdallo avatar gauthiermyr avatar jwessel avatar kanewersa avatar maxzabarka avatar namdaoduy avatar nbobito avatar onlaj avatar porcupineyhairs avatar rickstaa avatar sirlefti avatar sivanduijn avatar sreich avatar stephen322 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

piano-led-visualizer's Issues

visualizer.py error

i have installed all the requirements and follow all the given links and i have tested the given tests and they work properly , but my problem currently is for the visualizer , where i have tried many things to make it work but i get no clues , below is the output log when i tried to sudo the visualizer

> sudo -E python visualizer.py
> no output port
> no light port
> Traceback (most recent call last):
>   File "visualizer.py", line 641, in <module>
>     menu = MenuLCD("menu.xml")
>   File "visualizer.py", line 168, in __init__
>     self.update_songs()
>   File "visualizer.py", line 172, in update_songs
>     songs_list = os.listdir("Songs")
> OSError: [Errno 2] No such file or directory: 'Songs'
> 

please guide me what should i do ?

Raspberry pi zero wh is not available

Raspberry pi zero is not available in the Ali Express link you mentioned and its out of stock. I cant buy from amazon cuz there is some problem in there. So can u update a another seller with this item in Ali Express
20191129_185228

midi file

Hi, do you know how to get the midifiles I am recording with the raspberry?
The are saved in "Songs" but how can I get them to my PC?

No playback port & leds doesnt respond to keys

Hi there. I set up the raspberry after the github instructions, the leds are working with the strandtest.py examples, but when i connect my piano to the rpi, and run the command:

sudo -E python visualizer.py

It show me the piano name, but says “no playback port” and the leds doesnt light up. Any ideea why?
I dont use synthesia btw, and i use “python3” because if i write only “python” it runs with pyton 2.7, which is not in use anymore (i think).

845C3792-6FC7-48E2-AF43-5A2AB3C81E39

auto reconnect after piano shutdown

Hello ,

i have been testing the project now for a while and every thing is working very well thanks to the owner of this project , but i am facing currently a small issue which is in this scenario : the RPi and its script is always compiled and turned on but the problem my piano has auto shutdown time when user is inactive maximum to 2 hours so when it turned off i need to cancel the script then turn it on again , so is there any workaround to solve this issue without the need to recompile the script.

Wiring the LCD hat to breadboard

Hi Onlaj, how did you wire everything around the first time around? I'm having some difficulty with the breadboard connections.

I'm especially interested in how the waveshare 1.44in lcd hat should be wired up, not so much the rpi to the breadboard (which pretty straightforward)

mido input list

I wrote that LEDs do not respond to key press.
I found that my piano name is not on the midi input list when I connected RPI to my piano.
But screen saver works well(the screen saver stops if it is not connected to the piano).
any solution?? :(

LEDs don't respond to key press

I followed your guide and operated my raspi.
But when I pressed key, LEDs didn't work(but led animation wokred).
So I formatted my sd card and restarted installation. But the result was same.
what's the problem?? any solution?

Purpose of output port?

Looking through the code, it doesn't seem like output port (outport) really does anything at this time. What is its intended purpose?

I have almost everything working, but I am trying to figure out the Synthesia setup.

Synthesia for the iPad is connected to RPi-Bluetooth, and set to visualizer Input. How would I then get the keyboard connected to the Synthesia?

Do I need to connect the keyboard to Synthesia via a cable?

Can the pi emit two bluetooth midi devices?

61 keys

Thank you for providing this guide.

Is it possible to edit the code to use with a 61 keys keyboard?
How ?

Some LCD screen error for the visualizer.py

After I install all the requirements.txt library and connect the LCD screen
I execute the the command sudo -E python visualizer.py, I got following error.

Traceback (most recent call last):
File "visualizer.py", line 3, in
import LCD_1in44
File "/home/pi/Desktop/pianoled/LCD_1in44.py", line 28, in
import LCD_Config
File "/home/pi/Desktop/pianoled/LCD_Config.py", line 38, in
SPI = spidev.SpiDev(0, 0)
IOError: [Errno 2] No such file or directory

Do you know what this error mean and how can I fix it?

Waveshare LCD glitching

Hi Onlaj,

Thanks for the project. Almost everything works.

I only have an issue with the LCD screen. I am using the same waveshare screen.
When the rpi is booting the screen is white (nothing weird). After a while the menu shows. Now when I wait a couple seconds, the screen will be very glitchy and jumpy. Sometimes flashing green and sometimes switching to white again. When it has to white it will not come back to the normal menu untill I restart the rpi.

Sometimes the menu does work a couple minutes, but when I scroll though the menu, I see that key one sometimes needs to be pressed 2 to 6 times to work.

Do you have any idea how to fix this? The screen is brand new.

Thank you in advance and a happy 2020!

Lcd screen issue

Hey man thanks a lot just wanted to ask if I don’t have an LCD screen now bevause of its unavailability , will this device still work without plugging a waveshare lcd screen
Thanks

Python-rtmidi error

Hello
I do the installation process in the following order:
First of all, I do the LED connection and install the libraries and activate SPI as your instruction. And after that, configuring automatic midi connection as your instruction.
Of course, I skip BLUETOOTH MIDI settings for two reasons (I don't need it and I get a lot of errors in launching it).
After the above steps, I clone the Visualizer in my Raspberry Pi 3B+ and Using pip install all libraries listed in requirements.txt file but python-rtmidi is not installed and I get the following error message:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-rtmidi is not available, but is referred to by another package

I tried other ways but I got another error message:
E: Package 'python-rtmidi' has no installation candidate

Could you please guide me where I am wrong and how to fix it.
regards

Standoff and screws too short

I built the project and everything is working great. now when assembling it inside the 3D printed case i find that the screws are too short to poke through the plastic + LCD hat to screw into the standoff. and on the bottom the standoffs aren't long enough to pass through to the bottom. Where did you aquire the standoffs and screws you used and what size are they?

Automatic bluetooth connection

Hi Onlaj,

Thanks for your project!

I have a question about the bluetooth function.

Is the rpi supposed to always send a rpi bluetooth signal so I can connect it to my laptop? Because mine doesn't. When I start the rpi, piano and laptop; I first have to acces the pi with my laptop to excecute the command sudo btmidi-server -v -n "RPi Bluetooth".
Then I can search for a new bluetooth device and connect with rpi bluetooth.

When I restart everything and want to connect rpi bluetooth again, I first have to delete rpi bluetooth in my laptop and search for a new bluetooth device.
Otherwise I can't find rpi bluetooth in synthesia.

I hope you can help me with this issue.
Thank you in advance and a happy 2020!

no playback port & inport set to RtMidiOut

I'm running the code on a RPi 3 v1.2, the piano has midi capabilities (I've accomplished similar results with an arduino + neopixel) so I know it can send proper midi data through usb.

I've installed the prerequisites and set DisablePlugins= pnat and enabled SPI, I've followed all the instructions and even doubled down on them to make sure the files created were all correct and there weren't any typos.

Here are the issues:

  • The LCD is jamming out and flickers like mad - It lights up with the menu upon initially running visualizer but after a couple seconds starts flickering until it reverts to a white LCD.

  • When running visualizer in sudo -E the keys don't light up

  • When running visualizer in sudo (no -E) they light up but with a noticable delay until an eventual failure

  • Upon running sudo -E visualizer python visualizer.py i get following messages:

Inport set to ARIUD:ARIUS MIDI 1 20:0
Inport set to RtMidiOut Client:RtMidi output 131:0
Inport set to RtMidiOut Client:RtMidi output 134:0
Inport set to RtMidiOut Client:RtMidi output 135:0
Inport set to RtMidiOut Client:RtMidi output 136:0
Inport set to RtMidiOut Client:RtMidi output 141:0
Inport set to RtMidiOut Client:RtMidi output 147:0
Inport set to RtMidiOut Client:RtMidi output 148:0
Inport set to RtMidiOut Client:RtMidi output 149:0
Inport set to RtMidiOut Client:RtMidi output 150:0
playport set to ARIUS:ARIUS MIDI 1 20:0
no playback port

I'm using a WS21813 LED strip, and wired it up just like normal however with the backup data cable put to the same GND on the RPi as the GND coming out of the strip. I am confident in my wiring, I think there may be something wrong with Pulseaudio being run in the wrong environment, I briefly got an error message (when running from terminal) stating

xdg_runtime_dir (/run/user/1000) is not owned by us

But it disappeared after reverting to the desktop environment. I've made sure SPI is enabled at all times, I have no idea what to do now and any help will be greatly appreciated!

I tried to auto run your script every time the Raspberry boots but I get this error message...

I followed these instructions to auto run your script: https://www.raspberrypi-spy.co.uk/2015/02/how-to-autorun-a-python-script-on-raspberry-pi-boot/

Used the 'A Script Without End' part because your script uses an endless loop. When I reboot, I get this error message:

Traceback (most recent call last):
File "/home/pi/Piano-LED-Visualizer/visualizer.py", line 641, in
menu = MenuLCD("menu.xml")
File "/home/pi/Piano-LED-Visualizer/visualizer.py", line 161, in init
self.DOMTree = minidom.parse(xml_file_name)
File "/usr/lib/python2.7/xml/dom/minidom.py", line 1918, in parse
return expatbuilder.parse(file)
File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 922, in parse
fp = open(file, 'rb')
IOError: [Errno 2] No such file or directory: 'menu.xml'

However, the script runs perfectly fine if I manually start it. Do you know how I could make it work?

configuration for 49-key midi controller

So I've tried just changing the led count to 98, as well as a few lines under keylist, keylist_status

The resulting behaviour is on the default octave the light activated is an octave too high, as well as being maybe 5 leds too high.
I had a look through the config but I don't see a way to tell the software the first led is the first key of a 49 key controller, and to ignore octave change messages.
Awesome to see the three led option implemented btw <3

connecting wires to GPIO pins

Hi, I have gotten the code to work, I am just having trouble getting the cables connected to the GPIO pins. Do you connect the cables before or after you install the LCD hat? When you say wrap, do you mean just curling it around the pin with your finger, or using a wire wrap tool? do you know any tutorials I should watch in order to do this? i am very lost

Running Visualizer.py

Hi,
Just having a problem with running the visualizer. I went into library ' cd Python-LED-Visualizer ' then ran ' sudo -E python visualizer.py ' but when running it said 'missing module, import rtmidi' - something along those lines? Have i cloned correctly? And so i need to be in ' Read only Mode for this to work?' ive tried this numerous times becuase my sd sometimes crashes after rebooting. Any thoughts would be appreciated..
Thanks
Harry

Takes 50+ tries to connect to keyboard

Hey there,

Whenever I insert the usb connector from the rpi to my keyboard, it rarely reads my keyboard, maybe 1 in 50 I will see it activate and appear in the input list, and when it does work, it doesn't last long.

I have tried unplugging everything and reconnecting, reloading the rpi software, buying new cables, and even then it takes many tries, and when it does work, it only lasts for a few minutes before glitching out and being perma stuck on a few lights, or just not working at all. (The LED lights work perfectly when testing the animations)

Is it a hardware or software problem, and can you please recommend a fix?
Thankyou!

only 176 LEDs work?

Hello. I have a question.
I bought 2m LED strip(144led per meter) and I connected all wires.
However, only 176 LED worked and the rest didn't.
(I have total 288 LED because of 2 meter strip)
Is it right response?
is there a way to make all LEDs work?

Do anybody have ready iso file with this project?

Hi, im struggling with lots of errors and have no time to do with this project anymore. Do anybody have working system and is able to share just ready to download iso image from SD card? If yes please share with me. I will be very gratefull. Thanks

Attribute Error while running visualizer.py

Hey man I'm running into this error when running visualizer.py

File "/home/pi/.local/lib/python2.7/site-packages/mido/backends/rtmidi.py", line 34, in _get_api_id return rtmidi.API_UNSPECIFIED
AttributeError: 'module' object has no attribute 'API_UNSPECIFIED"

I've uninstalled any variants of python-rtmidi like rtmidi_python and rtmidi but am still running into the error

Thank you!

Ws2813 wiring?

I have a slightly different strip (ws2813), how should I wire it to the rpi? Is it possible without a level shifter?

What I am currently doing:
Data: gpio19
Clock:gpio23
GND to GND

MIDI Connection Fails

I successfully installed all the requirements listed in your documentation. By executing the command 'aconnect -l' it gives me the following result:

pi@raspberrypi:~ $ aconnect -l
client 0: 'System' [type=Kernel]
0 'Timer '
1 'Announce '
client 14: 'Midi Through' [type=Kernel]
0 'Midi Through Port-0'
client 20: 'MIDI 1 x 1' [type=Kernel,card=1]
0 'MIDI 1 x 1 MIDI 1'

By executing the command 'mido-ports' I get this:

pi@raspberrypi:~/Piano-LED-Visualizer/tests $ mido-ports

Available input Ports:
'MIDI 1 x 1:MIDI 1 x 1 MIDI 1 20:0'
'Midi Through:Midi Through Port-0 14:0'

Available output Ports:
'MIDI 1 x 1:MIDI 1 x 1 MIDI 1 20:0'
'Midi Through:Midi Through Port-0 14:0'

MIDO_DEAFULT_INPUT not set.
MIDO_DEFAULT_OUTPUT not set.
MIDO_DEFAULT_IOPORT not set.
MIDO_BACKEND not set.

Using backend mido.backends.rtmidi.

Running the test program lightkeys.py fails in line 37 with the following result:

pi@raspberrypi:~/Piano-LED-Visualizer/tests $ sudo -E python lightkeys.py
Traceback (most recent call last):
File "lightkeys.py", line 37, in
inport = mido.open_input('mio:mio MIDI 1 20:0')
File "/usr/local/lib/python2.7/dist-packages/mido/backends/backend.py", line 91, in open_input
return self.module.Input(name, **self._add_api(kwargs))
File "/usr/local/lib/python2.7/dist-packages/mido/ports.py", line 161, in init
BasePort.init(self, name, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/mido/ports.py", line 86, in init
self._open(**kwargs)
File "/usr/local/lib/python2.7/dist-packages/mido/backends/rtmidi.py", line 125, in _open
virtual=virtual, api=self.api)
File "/usr/local/lib/python2.7/dist-packages/mido/backends/rtmidi.py", line 93, in _open_port
raise IOError('unknown port {!r}'.format(name))
IOError: unknown port 'mio:mio MIDI 1 20:0'

Any idea what the problem could be? I searched the net for any issue but couldn't find any result. The strandtest.py runs well and the LED stripe lightens up. I connected my piano using a MIDI-to-USB adapter to the USB socket of the Pi. The Raspberry is running Python 2.7.13. The system is updated with the latest updates/upgrades.

Rasberry Pi0 delay and some keys dont respond

Hey man!
I initially had rpi3 and had this error of delays in the key press as well as some keys dont respond.
Should I change the midi usb cable?
Also I am not using a Power adapter for ws2812b. Direct power supply to rpi and from rpi to lights.
Can this also cause delay? Thanks :)

Question regarding the Display

i build everything like you said in the tutorial and thanks for that!

now i want to buy a raspberry pi 3 , will it work with that raspberry? and what about the display ? do i have to buy another and will another display work with the scripts?

Midi delay

Hi, I got everything working, but there is a delay between midi and audio. Is there a way to fix?

Needs automatic port setup for Play_MIDI

Automatic port setup was added a few days ago in this commit:

5d5df51#diff-20e433b96c154faaedd1c04789627107L609

It would be nice if that could be done when trying to play midi as well:

https://github.com/onlaj/Piano-LED-Visualizer/blob/master/visualizer.py#L369

I'd submit a PR, but I'm a little confused. Was the intent of midi playback to use playport?

if(location == "Choose_song"):            
    play_midi(choice, 'mio:mio MIDI 1 20:0')
.
.
.
def play_midi(song_path, port):
    menu.render_message("Playing: ", song_path)
    try:
        mid = mido.MidiFile("Songs/"+song_path)
        port = mido.open_output(port)
        for msg in mid.play():            
            port.send(msg)  
            if GPIO.input(KEY2) == 0:
                break
    except:
        menu.render_message("Can't play this file", "", 2000)

vs

if(location == "Choose_song"):            
    play_midi(choice)
.
.
.
def play_midi(song_path):
    menu.render_message("Playing: ", song_path)
    try:
        mid = mido.MidiFile("Songs/"+song_path)
        for msg in mid.play():            
            midiports.playport.send(msg)         
            if GPIO.input(KEY2) == 0:
                break
    except:
        menu.render_message("Can't play this file", "", 2000)

FWIW, since I'm coming up to speed on MIDI, it would be nice in the docs to have the purpose of inport, outport, and playport -- even if it is just common sense, and I'm being an idiot :)

Led light color control request

Hi, Aleksander Evening, does this possible can control led with two different color for both hand? Like right assign as green and left assign as red.

Usb midi pass through?

Hi, thanks for all your work :)
I'm pretty sure I'll have it working once I select the input port, I haven't soldered the pins needed for the screen yet, I think setting it to Bluetooth by default will work as it did for another open issue.

As latency is a concern I want to try using direct usb midi, but I also use the midi for a vst instrument on my laptop (garritan cfx :D)
So I'm wondering can I set my Yamaha piano as midi input then output from the rpi (over a male to male usb cable) to my laptop?

LCD Display is getting white

Hi Onlaj,

first thanks for your guide!

Finally I managed to connect the keyboard (Yamaha P-45B) with the Raspberry Pi and Synthesia.
Synthesia is waiting for me to press the keys and the LEDs light up accordingly.

However, I still have 2 small problems/questions, maybe you can help me.

First my setup:
Raspberry Pi 3 Model B Rev 1.2
LCD Display Waveshare Raspberrypi 128x128 (the same one you use)
WS2812B LED Strip currently only 1 meter (I'll change it soon)

Problem one:

As soon as I call sudo -E python visualizier.py as pi user, my screen becomes completely white. Before that it shows the normal Linux console.

Can you explain to me how I get the menu shown on the display where you select the songs?
How do I get this displayed after the Raspberry Pi restart?

I don't know if it's because I was forced into Pythonscript: LCD_Config.py make an adjustment:
from SPI = spidev.SpiDev(0, 0) to SPI = spidev.SpiDev(0, 1)

The reason for this is that I don't have /dev/spidev0.0... i just don't know why

Problem two:

I would like the LEDs to light up before I press the buttons.
At the moment they light up together with the keystroke.

pi@raspberrypi:/usr/led_piano/Piano-LED-Visualizer $ aconnect -l
client 0: 'System' [type=Kernel]
0 'Timer '
1 'Announce'
client 14: 'Midi Through' [type=Kernel]
0 'Midi Through Port-0'
client 20: 'Digital Piano' [type=Kernel,card=1]
0 'Digital piano MIDI 1
connected to: 128:0
connected from: 128:0
client 128: 'RPi-Bluetooth' [type=User,pid=569]
0 'RPi-Bluetooth '
connected to: 20:0
connected from: 20:0

If i run the printmidimessages.py it shows a lot of "clock time=0"..
pi@raspberrypi:/usr/led_piano/Piano-LED-Visualizer/tests $ sudo -E python printm idimessages.py
Inport set to Digital Piano:Digital Piano MIDI 1 20:0
clock time=0
clock time=0
clock time=0
clock time=0
clock time=0
clock time=0
clock time=0
clock time=0
clock time=0
clock time=0
note_on channel=0 note=59 velocity=49 time=0
clock time=0
note_on channel=0 note=60 velocity=49 time=0
clock time=0
clock time=0
note_on channel=0 note=53 velocity=38 time=0
clock time=0
clock time=0
clock time=0
clock time=0
clock time=0
clock time=0
clock time=0

Thanks in advance!

Length of LED strip too short?

Was working perfectly! Now doesn't recognize keyboard

Hey, appreciate your work! Quick question:

I had this device built for me and it was working perfectly, synccing to my keyboard no problem for eg. CASIO on the input list. Then suddenly next day, one light on the LED strip perma stayed on, and soon after it became unresponsive.

Now, it reads all keyboards as USB DEVICE, and doesn't activate the lights anymore (but the lights still work when tested using LED ANIMATIONS.

It's definitely not hardware and have tried multiple different cables keyboards and unplugging, it seems to be a driver issue. Any idea how to get it to read my keyboard as CASIO like before? As i suspect this is the problem. Any help/ fix instructions greatly appreciated!!!

123
555

MidiPorts instance has no attribute 'inport'

Hi, Im quite new to RPI and MIDI and trying to run the visualizer. But get a error;

  1. $ sudo -E python visualizer.py
  2. Traceback (most recent call last):
  3. File "visualizer.py", line 733, in
  4. midipending = midiports.inport.iter_pending()
    
  5. AttributeError: MidiPorts instance has no attribute 'inport'

I have synthesia on my laptop connected with bluetooth, i can send midi and i can see with the bluetooth test (sudo btmidi-server -v -n "RPi Bluetooth" ) that i receive data on my rpi.

I dont really see a solution for this problem atm. can you help me?

Detailed wiring / connectors / wires explanation?

I'd very much like to make this project for myself and for someone else.

However, whilst I can understand the software side, I've never done any soldering or wiring before and neither this nor the reference article go into any detail on how to actually make this up, what type of wiring to use, what type of connectors are required, and how / where to create or solder custom wires.

The closest is a poor graphic showing a splitter wire, but none - as far as google / Ebay searches have demonstrated - can be found.

Is there some way to get more explicit hardware instructions and part list? I'm not interested in breadboards and pin connectors - this needs to be solid for a non-technical person to own / use.

Thanks

delay and skipped notes on rpi 3b+

Hi ,

Thank you for your effort ! i have been looking for a project like this for a while now :)
Unfortunately i am experiencing some difficulties when using visualizer on a rpi 3b+ (some how no one using rpi zero is concerned by this ... ) . when i touch a key on the keyboard there is a 1-2 second delay ! and when i do it fast , it skips many note !

Thank you .

RPi Bluetooth plus synthesia learning set up

I don't think this in the scope of an 'issue' but just some extra information for those that try. Synthesia learning set up with RPi bluetooth only worked for me using Synthesia from a windows pc. I tried previously with an ipad and macbook, which both gave erratic results for the 'learning' LED lights (when setting visualiser to RPiBluetooth as input).

Feature Request: Colors assigned to notes

If possible and feasible, could you please add functionality to set colors for different piano notes. eg. i should be able to set a specific color for all the keys mentioned below so whenever I hit a specific key in any octave, the same color should light up:
C, D(Flat), D, E (Flat), E, F, G (Flat), G, A (Flat), A, B (Flat), B

Thank-you for the consideration

ImportError: No module named webcolors

when i connect my rasp to PC and type "sudo python -E visualizer.py", this message pop up.

Traceback (most recent call last):
File "visualizer.py", line 15, in
import webcolors as wc
ImportError: No module named webcolors

I already install webcolors using "pip install webcolors".
what should i do??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.