3 minute read

Compile - Taimur Shaikh 12SCH

COMPILE

How I made a computer composer music - Taimur Shaikh 12SCH

The subject of computers mimicking human creativity is one that has been investigated time and time again, alwaysproducing stunningnewresults and observations. Take, for instance, OpenAI’s GPT-3, which can write convincing newspaper articles and texts in the style of Shakespeare, or ‘Vincent’ by Cambridge Consultants, which can complete a painting given a human-drawn sketch. Indeed, these are astounding breakthroughs thatinvite all sorts of new creative possibilites.

Music has also been experimented with as a facet of this overarching branch of computing; there have many separate initiatives that have aimed to translate the creativity and humanity of music making into humble ones and zeroes in a machine’s memory. There arethe likes of Magenta by Google, which houses a browser based lofi generator. There’s also Jukebox, again by OpenAI, and AIVA, which generates personalised, continually changing tunes to fit whatever moodyou desire.

Inspired, I set my sights on my own AI music implementation, but I opted for a different technique: genetic algorithms.

The name may sound scary, but these algorithms are relatively simple compared to other AI techniques. Essentially, they simulate the Darwinian processes of natural selection and evolution in a computer program. Everything in genetic algorithms can be described following this real-world analogy. We give the algorithm a list of data, and it treats each individual item in the list as an organism of sorts. The organisms can then be assigned an individual ‘fitness’ score, which denotes how suited an organism is to their ‘environment’ . In order to actually evolve these so-called organisms, we must select parents and breed them (I promise it’s not as weird as it sounds). To select parents, we randomly select two organisms, only that the selection is weighted by fitness –organisms with higher fitnesses are more likely to be picked as parents (again, mimicking what happens in the real world). These parents are then ‘crossed over’ , forming children organisms. This process can repeat over and over again until we are presented with the completed next ‘generation’ of organisms,which we can then apply the same algorithm two: assign fitnesses to each organism, select parents, crossover, and repeat this however many times we like. We can even add more complex behaviour, such as a mutation rate that, based on a small percentage, will randomly change the contents of an organism in order to introduce natural genetic variation.

So it’s clear that genetic algorithms have a lot of details to unpack, but how does this all relate to generating music with them? Simply put, the

organisms of a genetic algorithm can be whatever we like. In the case of music, we can create a list of number sequences, where each number corresponds to a particular musical note. We then adapt the algorithm as explained above for this specific context. The most notable adaptation for any genetic implementation is the fitness. We must create a sequence of steps that can calculate fitnessof music. What does that even mean? How can we determine how ‘fit’ music is? This was the hardest part about developing this, but I settled on designing an algorithm that takes into account aspects of melody, rhythm and harmony to holistically score a specific note sequence. We can then undergo the parent selection, child generation, and mutation processes as normal, to eventually generate a set of musical sequences entirely composed by a computer. Cool, right?

What is even more fascinating, in my opinion,is the potential for actually putting these generated melodies to use. Armed with 1000s of custom generated note sequences, I began arranging tracks by layering sequences on top of each other, adding effects like delay and reverb, and syncing them to drumloops. The results were dreamy, aloof tunes akin to the popular lo-fi genre of hip-hop. I took 10 of my favourite tracks and created the album “COMPILE” –an entirely computer-composed album, with the help of yours truly, a human arranger. You can check out the album using this link: https://soundcloud.com/taimurshaikhmusic/sets /compile

This article is from: