Introduction: 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
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 https://github.com/tomcucinotta/MuseScore.git 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
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
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.
29 Comments
5 years ago
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?
Reply 2 years ago
you should have noticed by this time, that the project has also been made available as pre-compiled for both Linux and Windows; please, check the published releases at:
https://github.com/tomcucinotta/MuseScore/releases
thanks, T.
Reply 5 years ago
in case you lost motivation and couldn't compile it, now there's a shortcut: binary installation for Linux as well as Windows :-)!
https://github.com/tomcucinotta/MuseScore/releases
Reply 5 years ago
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?
Reply 5 years ago
Hi, your best friend is the MuseScore support page
https://musescore.org/en/support
and particularly the forum:
https://musescore.org/en/forum
as well as (dev) mailing list:
http://dev-list.musescore.org/
Please, let me know if you sort this out, thanks!
3 years ago
Man I would really love to make it work, but I‘m getting an error in the PianoTutor.ine file, it says there‘s a “stray #” on line 31 ...the one that goes “#define NUMPIXELS 144”
I know this post is relatively old but I hope you can help me, please!
Reply 2 years ago
please, post technical questions on the github tracker for the project at:
https://github.com/tomcucinotta/MuseScore/issues
Thanks.
5 years ago
Thanks you for sharing, I have made similar, but I made my own LED bar using 2 of 8x7 LEDs segment driver Max7216 and drove that with your code. I have full 88 keys and matching LED to cover the entire range. It works very well. The only trouble I have is that the settings. I have to change it every time as musescore doesnt seem to remembered it. I used the precompiled version you post for windows. is there away to make the setting stored in Musescore, particularly the COM port number, the number of LED, the C4 key# in the Piano Tutor panel?
Reply 5 years ago
I forgot: it would be very cool to see a picture of your hardware set-up :-)! feel free to share it.
Reply 5 years ago
Yes certainly, please follow this youtube link to see my project.
But I warn you, I did it with my wife breathing down my neck so it is quite crude, please hold back the criticism :)
https://www.youtube.com/watch?v=U_dCZzUptzs
Reply 5 years ago
hi there, happy to hear this comes useful to you! there's certainly a way to make these configurations persistent, and there's a number of other TODOs that deserve attention -- just I couldn't find the time to dig into these, as of yet! any contribution to the code would be very welcome of course :-)! however, stay tuned (the reference pointer is the LinkedIn page where I have the full tutorial on how to set the PianoTutor up), and hopefully some improvement to the code will come soon :-)!
5 years ago on Introduction
Now the modified MuseScore software is (also) available as a binary release, for Ubuntu/Debian Linux as well as Windows:
https://github.com/tomcucinotta/MuseScore/releases
5 years ago
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!
Reply 5 years ago
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!
5 years ago
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.
Reply 5 years ago
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...
Reply 5 years ago
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!
Reply 5 years ago
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)
5 years ago
Very well explained about Piano Tutor .And its Great informatinon
Reply 5 years ago
thanks!