Created
February 13, 2016 01:29
-
-
Save msroot/9b1d998884ed44ca2926 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Define Music: | |
| # Vocal or instrumental sounds (or both) combined in such a way as to produce beauty of form, harmony, and expression of emotion. | |
| class Music | |
| has_many :sounds | |
| has_many :notes , through: :sounds | |
| sequences_of_emotions = [] | |
| def good user | |
| sequences_of_emotions.select { |e| e == user.definition_of(Music, :good) } | |
| end | |
| end | |
| class Sound | |
| has_many :notes | |
| end | |
| class Note | |
| has_many :sequences | |
| end | |
| class Vocal < Sound | |
| end | |
| class User | |
| DEFINITIONS = { | |
| music: { | |
| good: [] | |
| } | |
| } | |
| def definition_of klass, type | |
| DEFINITIONS[klass.downcase][type] | |
| end | |
| end | |
| # a user can say: | |
| # | |
| # Play some good music | |
| # | |
| # 1. play = action the computer has to execute | |
| # 2. some = the range | |
| # 3. good = a selection based on the user for the object(music) | |
| # 4. music = the subject | |
| # the only hard to explain here is the "good" because the good based on the expectation we want. | |
| # what is good music? and what is good in general? | |
| # good: to be desired or approved of. | |
| # So we should define what is good for us based on the previus examples | |
| # How can u define good? what music is do so will do "good" to me? | |
| # IF: i accept these type of sequences and i will hear them it is good for me | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is another way to do this. Let's say we want to compose a song using only
the piano. So we start by setting some parameters like:
Then we tell the computer:
Make every possible combination of notes sequences that match these parameters.
A piano song is a sequence of notes and spaces. So it is easy to represent
using an array of numbers. A piano for instance has 88 keys, you could
represent a song in an array:
here how you make random piano song:
then play it:
You can generate all possible 100-note songs with a simple method:
But that would take a long long time. Because regular computers today are too
slow to do it. In a few years this would be possible to do on your laptop.
Once this happens, we would sit down and just select what we like.
The first result of the program would be
all_possible_songsminus the oncesthat don't match the initial parameters you set.
You would listen to the first few seconds of a song and tell the computer if
you like it or not.
Every time you do this a program will filter out the songs you don't like from
the result, so you would go from the initial million to half a million, then a
quarter and eight. Until you find a song or a several song you like.
Once you have a few songs you like, you tell the computer now make more songs
like these ones. And repeat the process.
The main thing here is:
When computers are super fast and software smart, it will be possible to genera
every single song that you can fit in 5 minutes, and then select the ones that
are similar to what humans like. Every single one.
Sounds crazy but it is possible in theory.