An elegant MIDI piano takes on an extra dimension with the ability to guess the music you’re attempting to play
By hooking up a MIDI keyboard to a Pi, Andreas Scholz and karsten Schick created a piano that attempts to guess what you’re playing…
The two German makers behind the MidiIdentifier are an interesting but unassuming pair that seem largely unaware of how good their little tinkering project is. The MidiIdentifier seems to be the first that they have publicised, which is surprising given the quality of the work; it was largely built out of a love of the old Apple II computer design and the desire to do something clever but simple with music recognition.
This is such a stylish project – what inspired you to build it?
Thanks! We are both computer scientists. This sometimes makes it difficult for our family and friends to understand what we are actually doing. With this project, we wanted to build something that can be easily grasped (in a literal sense) and that we could show to our friends as well. It was also important for us to create something others could interact with in a fun and creative way, and we feel that music enables them to do just that.
What made you decide to use the Raspberry Pi?
We didn’t really think about it – it seemed the obvious choice at that moment. We knew we needed a computer that could be connected to a piano, a touchscreen and an external soundcard, as well as run the code. Together with its small-form factor, this made the Raspberry Pi the obvious choice for us.
What coding or libraries were involved in the project? Our coding was done mainly in Python 3 along with a number of shell scripts. We made use of a variety of Python libraries including pygame for audio processing, tkinter for the user interface, mido to deal with the MIDI file format and the fluidsynth synthesizer for output.
How does the music identification aspect of the project actually work? The MIDI format is actually quite complex – too complex for our purposes. So for our first step, we implemented a mechanism to convert the MIDI input from the piano – as well as all the MIDI files in our library – into a simpler format. On the basis of this format, we experimented with different algorithms to get as best a matching as possible while still being as forgiving to faulty input (wrong notes, octave and timing and so on) as possible. This was actually a very fun part of the project. It enabled us to be creative with algorithms and laugh in disbelief at how badly some of them worked.
Can you explain how you made the case?
We drew our inspiration for the case from the Apple II computer. After some paper prototypes and a very amateurish technical drawing, we used Adobe Illustrator to digitise the sketches. To generate the joints for the individual parts, we used a wonderful online tool called Joinery (https://clementzheng.github. io/joinery). Finally, we used a laser cutter to cut 3mm plywood and put everything together.
Would you do anything differently now? What advice can you give to someone attempting your project?
We would probably start developing on Raspbian right from the start. Initially, we developed the Python code on Windows, expecting for it to work the same way on a Linux system due to the generally very good crossplatform compatibility of Python. However, it turned out that Raspbian and Windows differ fundamentally in how they deal with MIDI sounds. That took a lot of time to figure out. As for recreating our project, don’t be afraid of diverging from our write-up. In the end, there will always be something you encounter that we didn’t. Just go with the flow and solve the problems.
We experimented with different algorithms to get as best a matching as possible while still being as forgiving to faulty input
What was the most challenging part of the project? Getting MIDI files as well as individual notes to play correctly on the Raspberry Pi via the external soundcard. This sounds easy enough, but Raspbian did put some obstacles in our way there. The different behaviour on Windows and Linux complicated the matter even more.
What do you have in mind for your next project? Another musical project?
[KS] I don’t have anything particular in mind, but I am interested in home automation and consider pursuing a project in that area.
[AS] Not a musical project, but I have an idea for an interactive art project I’ve been wanting to build for some time now. Stay tuned.