GA Chords

 

Live: https://www.sunwangshu.com/projects/spring-2017/noc/gachords/

When learning about genetic algorithms, I really wanted to see how it feels if I can evolve on some melodies or chords.

So I did this experiment, get a bunch of random notes and pick the ones I like, and creating new generations based on the ones I like.

 

I used two classes, Chord inside Chords. Chords manages all Chord objects inside the class.

Overview:

It’s generally picking the ones you like, creating new generations based on them, and discarding / reusing the ones you don’t like.

Significance:

Each Chord object will randomly contain 2-4 different midi notes when created, and it has a value named Significance that determines its height.

Reproduction:

If mouse holds down and push the chord up, the significance will increase and it will be levitated.

Once significance reaches its maximum (when it reaches the top of canvas), it will create two more child that is based on the parent, but may vary in the number of notes / pitch of notes.

Destruction: 

All chord object will gradually fall down until it stay on half significance. If mouse holds down and push down the chord object, then the significance will decrease even more and it will continue falling until vanish when reaching 0 significance.

More:

Press Space to add 7 more new chords.

 

After several rounds of selection, you can easily get a bunch of chords you like.