🧬🎵 Music Evolved 🎵🧬 - Visualize, Generate and Evolve Music!
MusicEvolved allows you to visualize, generate and evolve new music using Markov Chains and an interactive Genetic Algorithm. Everything is explained in the website, so you are welcome to try it out for yourself or continue reading.
Here is our visualization of Chopin's Concerto No. 1:
Isn't it beautiful?
Each column in this 128x128 matrix represents a MIDI note, and each row represents a note that comes after it. Dark colors represent low values, and bright values represent high values. For example, if the cell in the 5th row and 2nd column is bright, that means that note 5 very often comes after note 2 in Chopin's Concerto No. 1.
In other words, this is a grayscale-image representation of the Markov Chain corresponding to Chopin's Concerto No. 1.
Go ahead! Try it yourself with your favorite songs (just remember to upload them in MIDI format) or some interesting ones from our library.
Using a matrix like the one above, we can generate new songs.
We first pick a random note, and step-by-step pick the next note, with probabilities corresponding to the brightness of it in the matrix, or to the number of times it appeared in the original song.
In rough terms, this works similarly to the autocorrect system on your phone: the word "am" follows the word "I" more than the word "are" follows "I", and so it is recommended and picked a lot more often. Generating a song like this is similar to starting with a random word, press the first word your phone suggests, and so on.
In our website you can also draw your own matrix, and hear the results!
Once you have a few songs ready, you can start evolving them.
This is done by crossover and mutation.
In crossover, the matrices (the DNA) corresponding to the two elements are combined, and a new element is created.
This simulates a genetic algorithm, which is an interesting idea in Computer Science. A genetic algorithm is a way to model our own world, specifically the ideas of evolution and "survival of the fittest".
In a traditional genetic algorithm the computer picks the best elements of the population using some criteria, but in this simulation you get to pick your favorite songs by yourself, and evolve them.
To add some variation to the generated elements, you can manually edit them or use the mutate button to slightly change them.
Go ahead! Try it out for yourself at musicevolved--alephzero.repl.co, view the source code at repl.it/@AlephZero/MusicEvolved, or even create your own fork and add some interesting features!
Also, if you have any feedback, suggestions, or found any bugs please comment below! We would love to hear what you think.
This project was programmed entirely on Repl.it, by my brother @LilTaco and I @AlephZero. It took us about 2 or 3 days to complete. The idea to work with Markov Chains was inspired by my linear algebra class, and a wonderful project called lyrics.rip.
Because of repl multiplayer issues, we worked on a few different repls:
https://repl.it/@AlephZero/MusicEvolved (The final project)
https://repl.it/@liltaco/MusicEvolved-Frontend (Used in the beginning for frontend work)
https://repl.it/@liltaco/MusicEvolved (A fork used to develop some features)
https://repl.it/@liltaco/MusicEvolved-1 (Another fork)