Saturday 4 October 2014

Python Plays Bach

I showed this Youtube video to a respected colleague and massive Python fan a few days ago. I never expected the reaction I got.

Bach Passacaglia and Fugue in C Minor

He thought my efforts in Python produced the spectrogram which I used for the visual part of the video. Whilst I would love to take credit, they are actually produced via ffmpeg.


When I explain to him that Python made the music; he did not believe me. He said that I was 'having him on' and generally taking the piss. When I further went on to explain that the sounds are not samples, but generated from pure mathematics, the only way to get him to believe my words was to show him some Python...

On github:

  1. https://github.com/nerds-central/SonicFieldRepo/blob/master/SonicField/scripts/python/Bach-Large-Organ.sy
  2. https://github.com/nerds-central/SonicFieldRepo/blob/master/SonicField/scripts/python/reverberate.sy

The programming model is that Python control the sounds and Java does the mathematical heavy listing. For example, here is the FFT code from Sonic Field:
  1. https://github.com/nerds-central/SonicFieldRepo/blob/master/SonicField/src/com/nerdscentral/audio/pitch/algorithm/FFTbase.java
  2. https://github.com/nerds-central/SonicFieldRepo/blob/master/SonicField/src/com/nerdscentral/audio/pitch/algorithm/CacheableFFT.java



He believed me when he saw code: It has been an amazing journey to get to such a point where Sonic Field has started to sound good enough to not be 'synthy'. It am very proud to have proven it can be done, that samples are not required to make beautiful sounds. Clearly, some people will not find the sounds my code has made pleasing, some will be shocked at how synthetic they sound. But at least now we can say at Python, at least for some people, makes music.

No comments:

Post a Comment