Quantcast
Channel: Machine Learning
Viewing all articles
Browse latest Browse all 62944

Genetic Algorithm for generating "music"?

$
0
0

I was inspired by this video series: Experimental One Line Music which was posted on r/programming a little bit ago. With a cursory introduction to genetic algorithms, I thought that it would be interesting to use them to generate these strings that generate music. Creating a generator of these strings randomly is pretty trivial, I think:

(where iter is the iteration variable, i)

  • s -> (val operator val)
  • val -> s | iter | const
  • const -> 0-4096
  • operator -> / | * | ^ | >> etc.

From what I understand about GA's, and correct me if I'm wrong, but we need to encode this string into a string of bits, which is where I ran into my first problem. Since this is a kind of grammar, you can't just change around any of these bits willy nilly, because then it might not be a valid sentence. So, rather than encode the string as single bits, I thought I could encode the string as integers which are then treated as bits in a traditional GA. Depending on the value of the integer, I could determine if it was a value or an operator and swap or replace accordingly. I think this would work, but I'm not familiar enough with GA's to know if this is a method that has been done before.

The second problem I have, and don't have a solution for, is what fitness function to use. I'm completely at a loss. I was thinking of checking the cycles that are generated, maybe for length or complexity? But I'm not sure, and that's where I'd like your advice. I'm not sure if I wan't a fitness function for a 'traditional' music generating GA, because it's not traditional music, but I don't know what is out there, so I'm up for suggestions.

Thanks!

submitted by Fuck_the_police
[link] [5 comments]

Viewing all articles
Browse latest Browse all 62944

Trending Articles