Music & Maths

How would you like to see some music? Having the sound turned into images and animations?

Lately, I have been trying to mix two of my passions: maths and music. More precisely, I wanted to reuse the concepts I had seen in signal processing to produce fun visuals to go with some music I made.

I eventually ended up creating a little series of videos that ‘show’ the sound in different forms: sound waves, frequency spectrums, volume bubbles…

All of these are on my Youtube channel, go and have look!

To do so, I read the sound files as signal data and then processed it with various methods, depending on the desired output. For example, for the Achernar title displayed above, I used the famous Fourier transform to get some spectrums and display the music’s frequencies. Other musics have quite a different render, you can see some below.

A ‘rain’ visualization of the Vega track
The bars show the importance of each frequency in the Polaris music

I did all this in Python (with the matplotlib, wave and NumPy libraries) and it was really nice to be able to easily turn these sounds into colors and movement! I adapted a code from Yu-Jie Lin and the complete project is available here (in a compressed .zip archive): just follow the usage() and find a WAV sound to use!

If you want a preview, here is the code that generated the video at the beginning of this article:

  1. Yu Jie Lin’s code:

2 thoughts on “Music & Maths”

  1. This is incredibly helpful. Thank you for posting! I’m surprised at how difficult it is to find practical examples of this sort of thing.

Leave a Reply

Your email address will not be published.