Introduction: MuseScore+Arduino+LEDs+MIDI = Piano Tutor

Picture of MuseScore+Arduino+LEDs+MIDI = Piano Tutor

This article explains how to turn your MIDI-capable keyboard or digital piano into a full piano learning & tutoring system, i.e., an interactive lighted keyboard/piano, based on the open-source MuseScore sheet music editor & player, a common Arduino board and a LED stripe. The system will let you practice a piano piece on the keyboard without any need for reading sheet music: just load any MIDI file on MuseScore, play it activating the Piano Tutor function, and then follow the LEDs lighting up on the stripe deployed along your keyboard, repeating as many times as needed.

Step 1: Hardware Set-up

Picture of Hardware Set-up

First, connect the NeoPixel LED stripe to your Arduino, plugging the black and red wires of the stripe to the GND and +5V pins on your Arduino. Also, connect the input data wire to the pin n.7 on your Arduino. The image shows how I did it in detail, however you can find more details on the Adafruit website.

Step 2: Software - Arduino

Download the software:

git clone 
cd MuseScore
git checkout piano-tutor

Install the Arduino IDE on your PC/laptop, then open within the above checked out git repository the miditools/PianoTutor/PianoTutor.ino file, and upload the program onto Arduino.

Step 3: Software - MuseScore on Linux

Picture of Software - MuseScore on Linux

Ensure you have all the build dependencies on your Linux PC:

sudo apt-get build-dep musescore
sudo apt-get install cmake-qt-gui

then, compile and install the modified MuseScore:

make PREFIX=/usr/local/mscore-git SUFFIX=-git release
sudo make install

now you're ready to launch it, opening a MIDI file of your choice:

/usr/local/mscore-git/bin/mscore-git /path/to/file.mid

and opening the Piano Tutor pane, pressing 't' (visible in the picture).

Step 4: MIDI Connections

Picture of MIDI Connections

Ensure your USB MIDI keyboard, or MIDI-to-USB adapter, is plugged into your Linux PC/laptop, and use qjackctl to ensure its MIDI port is connected to the MuseScore MIDI input port (see picture).

Step 5: Have Fun!

Have fun practicing with the millions MIDI files available on the Internet, without the burden of reading sheet music ;-)! You can see a video of the system in action on YouTube.

Should you have any trouble in any of the steps in these instructions, then please check out the additional details available here.


tuanh44 (author)2018-01-01

I find this a great project for my children to start interested in piano. So I decided to make one and finished with arduino part, but I'm having problems with compiling MuseScore (even with original version). Those started with "Q_NAMESPACE’ does not name a type...". Can you also share your laptop Ubuntu version, as I'm considering reinstall the OS to match it. Thanks a lot for any advice!

tcucinotta (author)tuanh442018-01-04

Hi there,

great to hear about your motivations, that's a perfect match with the reasons I shared the project ;-) !

My Ubuntu version used to be 17.04, but now I'm using 17.10 without problems. Your problems with Q_NAMESPACE let me think of possible issues with the Qt development files set-up (perhaps you're missing some libqt*-dev packages?).

On Ubuntu, these commands would normally pull all the needed dependencies:

sudo apt-get build-dep musescore

sudo apt-get build-dep musescore-common

Let me know if you run into further problems, I'm happy to help. For MuseScore-specifics, you might find quicker support on their own mailing list though!

ChristianS304 (author)2017-10-22

This is a really nice project, which is well written. Being a Windows user, but with some experience with Linux, I made a Persistent Live system on a USB stick with Ubuntu 16.04. There were several steps that initially failed, due to packages not available - but I made it to compilation which had a few errors. According to Musescore installation, QT5.8 is required - which is big and not available on apt (at least from what I can see - so I might need to start over. Is there any preferred Linux distro / other tips for this project which might make it easier for me, having a Windows computer?

I started on Ubuntu 16, but moved to 32 bit XUbuntu 17.10 Live persistant on a 8GB USB drive. It won't compile. I first removed prefix and suffix, which helped, but now it quits at 67% because pm.h cannot find portmidi.h. I tried to copy this from the thirdparty folder to mscore, which only got me to missing portmidi during linking. Anybody got a way to fix this?

tcucinotta (author)ChristianS3042017-10-28

Hi, your best friend is the MuseScore support page
and particularly the forum:

as well as (dev) mailing list:

Please, let me know if you sort this out, thanks!

DavidR882 (author)2017-10-12

I am having fun when playing with the piano tutor, thanks! One suggestion for future upgrade is that if replacing arduino with raspberrypi and a tiny screen, then the whole system is more portable without a PC. I have tried to replace the PC with raspberrypi, but I can't run the make command successfully, there are some build dependencies issues.

tcucinotta (author)DavidR8822017-10-12

The need for going more compact is understandable, although I'm seeing this best suited for a 360-degrees/convertible (possibly ultra-tiny) laptop, that can easily be placed on the piano bookstand.

Anyway, I guess you're trying to:
1) compile MuseScore on raspberrypi
2) get rid of the Arduino .ino code, along with any trace of serial communication with it inside MuseScore
3) replace the Arduino light driving logic with some NeoPixel libraries available directly for raspberrypi ?

Perhaps if you could post your changes and/or make logs, I could try to help, otherwise I can't say much...

DavidR882 (author)tcucinotta2017-10-18

Hi, that is what I am thinking. But I have some problem when build MuseScore on raspberrypi, I might try later and post the log here. Right now, I use VNC on iPad to remote access MuseScore, and put the ipad in front of the piano, and it works well. Thanks for your work!

tcucinotta (author)DavidR8822017-10-19

I see you found a nice hack to work around the problem of a bulky laptop on the piano ;-)... indeed the ideal one would be a 2-in-1 / 360 / convertible laptop (which I don't have either)

Louise Hudson (author)2017-10-11

Very well explained about Piano Tutor .And its Great informatinon

tcucinotta (author)Louise Hudson2017-10-12


DavidR882 made it! (author)2017-09-30

It works very well! Thanks! I used another LED strip, so there were little offsets for the keys that were far away. I think I will look into the arduino code and see if I can make any improvement.

tcucinotta (author)DavidR8822017-10-01

hi again, I made a few tuning attempts to chase the furthermost LEDs. I'd be curious to know what kind of LED stripe you have, but from the pic yours seems a set-up very similar to mine: standard piano/88-keys keyboard, 144 LEDs, mounted in 72+72, with some extra-space in between the two 72 halves. It turns out that, just adding to the code a little compensation for the extra space between the two 72-LED segments, the 2.0 scale factor that is currently used in the code (you see 144 on the dialog, but it becomes 144/72 = 2.0 internally) works just perfectly :-)!

DavidR882 (author)tcucinotta2017-10-05

The spec of the strip is the same, 144 LEDs in 1 meter. There is extra-space between two halves. My experience is that the right hand side's position is more accurate than the left hand side. I will try your tuning fix later. Thanks for your effort. This project let me want to practice playing piano again! :)

tcucinotta (author)DavidR8822017-10-01

cool, guess you won entitlement to click the "I made it!" button ;-)!

about the offset for far away keys, you can compensate that by tweaking the "144" LEDs/meter scale factor within the tutor dialog: you can try slightly larger or smaller values; among my TODO, there's to enhance the wizard so that it asks additional one or two key presses, so that it can auto-adjust the scaling... in case you have further ideas, or get it to work in other ways, just let me know.

DavidR882 (author)2017-09-27

That is very interesting! But where can I download PianoTutor.ino. It is not in the github MuseScore repository?

tcucinotta (author)DavidR8822017-09-28

I had a few pending commits local with my latest tweaks ;-).... beware, I'm used to push -f onto my hackish repo (you can clone again or force pull). This is a direct link to the .ino file, just in case:

tcucinotta (author)tcucinotta2017-09-28

forgot: please, ensure you switched to the piano-tutor branch after clone:
git checkout piano-tutor

DavidR882 (author)tcucinotta2017-09-28

Thanks! I am going to make this by following the instructions. BTW, when I compile the PianoTutor.ino, I got this error:

libraries/Adafruit_CircuitPlayground/utility/Adafruit_CPlay_Mic.cpp:84:37: error: 'analogPinToChannel' was not declared in this scope

So I have to remove the line:

#include <Adafruit_CircuitPlayground.h>

I will download it to the board and try on a LED strip soon!

tcucinotta (author)DavidR8822017-09-29

weird, perhaps a different version of the NeoPixel library ? I'm using this:


... and in this version including Adafruit_NeoPixel.h doesn't seem to have anything to do with Adafruit_CircuitPlayground/*, anyway, let me know how it goes, thanks...

DavidR882 (author)tcucinotta2017-09-29

sorry that I found the reason it included the Adafruit_CircuitPlayground was because I might have clicked the lib in the arduino IDE menu and it modified the file and auto imprted this lib. It is working perfectly. I will try to download some midi and try on my digital piano. Thanks!

tcucinotta (author)2017-09-27

thanks! looking forward for your comments after the "I made it!" phase :-)!

JosefS33 (author)2017-09-27

Very cool. Thanks!

seamster (author)2017-09-27

Very cool. I really like this idea, thanks!

About This Instructable




More by tcucinotta:MuseScore+Arduino+LEDs+MIDI = Piano Tutor
Add instructable to: