20. 1. 2021


Four themes and four ways of visualizing music. The generating script included!

The source for the visualizations is a waveform of a piece I recorded on a slightly out-of-tune upright piano using a smartphone.

The first (top) is a simple oscillogram of the waveform. It was generated with a Python script and matplotlib library.

The piano keyboard is an attempt at mapping the spectrogram (bottom) peaks onto piano keys which obviously didn’t work very well. It needs to be thresholded, filtered and processed properly. The video was generated using a SVG picture of piano keyboard animated using a Python script with Cairo and Rsvg libraries.

The third is a score typeset using Lilypond. This one is the only visualization which is not based on the waveform.

The fourth is a classic spectrogram. The analysis was done using the fast Fourier transform algorithm from Numpy library, the resulting image was generated using PIL library.

The scripts are available here.

The music itself is a piece I composed for my wife while she was in Australia for three months. It’s a montage of three music ideas. The first one is just a bunch of chords, the second one is a groovy theme which reminds me of Radiohead’s True love waits. The third one is a variation of a theme from my other composition: Passacaglia

The four visualizations were stitched and animated using Kdenlive.