Pianolizer helps your musical projects distinguish between notes

[Stanislaw Pusep] offered us the Pianolizer project – an easy-to-use toolbox for exploring and visualizing music, an audio spectrum analyzer helping you turn sounds into piano notes. You can run its toolkit on a variety of different devices, from Raspberry Pi and PCs to any browser-equipped device, including smartphones, and use its note output however you see fit. To show his toolkit in action, he installed it on a Raspberry Pi, with Python code taking note data and sending color information to the LED strip, displaying the notes in real time as he plays them on a MIDI keyboard! He also created a browser version which you can use with a microphone input or an audio file of your choice, so all you have to do is open a web page to play with the capabilities of this toolkit.

He took the time to make sure you could build your projects with the help of this toolkit, providing manual with command line and Python examples, and even shared all the code used in making the demo video. Thanks to everything he shared, you can now add piano note recognition to any project! Pianolizer is a standalone library implemented in JavaScript and C++ (which in turn compiles to WebAssembly), and the examples show how it can be used from Python or another language.

[Stanislaw] also documented the principles behind the code, explaining how note recognition does its magic in simple terms, while giving plenty of information. We are used to Fast Fourier Transform (FFT) being our go-to approach for spectral analysis, that is, recognizing different frequencies in a data stream. However, a general-purpose FFT algorithm isn’t as good for musical notes, because the intervals between note frequencies become wider as the frequency increases, and you have to do more work to distinguish the notes. In this toolkit, he used an SDFT (Sliding Discrete Fourier Transform) algorithm and tells us how he derived its parameters from the frequencies of musical notes. At the end of the documentation, it also gives you lots of useful references if you want to learn more about this topic!

What are you going to build with this? Maybe a box that records your flute playing and instantly turns it into sheet music? Or, perhaps, an AI that continues the song for you when you stop?