Can artificial intelligence create music?

In summary, you would need to spend time to learn SuperCollider, genetic algorithms, and a scoring algorithm to produce music.
  • #1
Avatrin
245
6
Hi

What approach should I take if I want to try this with music?

I know the mathematics that are needed to learn neural networks (from what I have read on websites like Coursera). Also, I know basic scientific programming with Python.

I am willing to spend time to learn how to make the musical equivalent to the art above. What skills do I need?

I know SuperCollider is a programming language made specifically for music, but is it useful for this? The impression I get is that it will be hard to import music to it to make new music.

Yeah, I know it will probably take more than a year, maybe several years, to learn it all, but I am willing to spend the time to do it.
 
Technology news on Phys.org
  • #2
The article you referenced referenced an arxiv article more details about what was done using convolution neural nets for image analysis. Perhaps in researching you will gain on how write a musical version.

However for music, I'd consider using genetic algorithms instead of neural nets. You could encode a song into a vector of sound elements. Each element would be the note, its state sharp or flat or natural, its duration and whether its part a slide. There may be other parameter needed for the sound element. You'd also need a set of song vectors to start the process and an effective scoring algorithm to throw bad song vectors old.
 
  • #3
jedishrfu said:
The article you referenced referenced an arxiv article more details about what was done using convolution neural nets for image analysis. Perhaps in researching you will gain on how write a musical version.

However for music, I'd consider using genetic algorithms instead of neural nets. You could encode a song into a vector of sound elements. Each element would be the note, its state sharp or flat or natural, its duration and whether its part a slide. There may be other parameter needed for the sound element. You'd also need a set of song vectors to start the process and an effective scoring algorithm to throw bad song vectors old.

I don't see how such a scoring algorithm could exist.
 
  • #4
Hornbein said:
I don't see how such a scoring algorithm could exist.

You could score based on how harmonious it was like does it have a run of chords, does it violate some key signature with too many misplaced sharps and flats. Do sequential notes jump too many octaves... Of course, you'd need to refine the scoring algorithm some to accomplish this perhaps by using known well liked songs.
 
  • #5
jedishrfu said:
You could score based on how harmonious it was like does it have a run of chords, does it violate some key signature with too many misplaced sharps and flats. Do sequential notes jump too many octaves... Of course, you'd need to refine the scoring algorithm some to accomplish this perhaps by using known well liked songs.

I have been a musician for over 40 years and can tell you that no one knows the rules for producing appealing music. I doubt that any such exist. I'm not optimistic about the neural network either, but at least you would have a chance in that it is not a certainty that it won't work.

Or I guess you could pay a horde of third world teenagers to rate the songs your algorithm produced.
 
  • #6
I played around with the Google deepmind stuff that produced the pictures here:

http://www.zmescience.com/research/technology/google-artificial-intelligence-dreams-04322534/

The general idea was based on downsampling an input image, and then using a convolution neural net to asses what its higher resolution form would like, repeatedly. Aftet many passes, it started to hallucenate things like dogs the NN had been trained for. There's probably no good reason you couldn't do the same with music, but you need a big training set of songs. After that though, and with right choice of inputs you just feed it a recording of your washing machine, and it starts to hallucenate a symphony...

The right inputs for the neural network are the tough part. Maybe look at mp3 compression for some ideas?
 
  • Like
Likes Hornbein
  • #7
Hornbein said:
I have been a musician for over 40 years and can tell you that no one knows the rules for producing appealing music. I doubt that any such exist. I'm not optimistic about the neural network either, but at least you would have a chance in that it is not a certainty that it won't work.

Or I guess you could pay a horde of third world teenagers to rate the songs your algorithm produced.

Im not trying to denigrate your experience as a musician. I thought the OP wanted to see what it takes to generate music on the computer and I provided an approach to consider. I am sure it won't generate exceptional music but could generate comparable music if you start with a single genre of music like folk or hawaiian slack key and use known tunes as the first seed and some simple mutation operators to swap notes or phrases between songs.

In the least it would some programming and how genetic algorithms work.
 
  • #9
This discussion has become way more focused than I intended. I wrote how much I know, which is not much; A bachelor degree worth of mathematics and some programming with Python.

I don't just want to know the machine learning aspect of this. What technologies should I learn? Should I learn some other programming languages?
 
  • #11
Avatrin said:
This discussion has become way more focused than I intended. I wrote how much I know, which is not much; A bachelor degree worth of mathematics and some programming with Python.

I don't just want to know the machine learning aspect of this. What technologies should I learn? Should I learn some other programming languages?

The AI stuff is really computer intensive, so it runs on GPUs, which are usually programmed in C. But since no one wants to mess with that, people write engines in C to do the math, and wrap them with something like python controllers, and control them through something like a Jupyter notebook, which is an interactive python interpreter in browser window. So you can do it all in python if the existing gpu math libaries have what you need.
Lasgne is a common python wrapped library forcconvnets
http://blog.christianperone.com/201...-networks-and-feature-extraction-with-python/
I had the code for making convnet LSD imagery I linked to, it takes several hours to get all the pieces and have it running, but at that point you have all you need installed and working. If I happen across it i will post it here.
 
  • #13
Isn't that cool? To be clear, I didnt have any part of the project, I just tinkered with the code they released because it amazed me too: By all accounts its exactly the imagery from psychedelic experiences, which tells me AI researchers are getting close to real understanding of the brain.

OP, I remembered the name of it, its here:

https://github.com/google/deepdream
Install, ipython, open the notebook, and I believe the instructions for all the depdencies are there. Once you install those you have a python based framework for tinkering with neural nets.
 
Last edited:
  • #14
Just read this, a little late, but your search has been answered, Google is doing it!
https://deepmind.com/blog/wavenet-generative-model-raw-audio/
Check out the classical piano scores, amazing!
 
  • Like
Likes mister mishka
  • #15
Have you seen this Ted talk?



Super awesome! Robots that can improvise with personality, and can emulate styles of specific artists, in real time (they can jam with you). The creator is Gil Weinberg, who has published many papers you've be interested in reading.

https://scholar.google.com/citations?user=-fyk-8UAAAAJ&hl=en
 
Last edited:
  • #16
I wrote some algorithmic composition code when I was learning AI. It's actually quite simple in some ways.

For example, perhaps you want a function to compose a good melody. There are some well-known rules for making good melodies. You use recursive search with backtracking, beginning with the first note, then continuing with each note as you test the existing sequence of notes against the rules for a good melody. The notes are selected at random from the appropriate set of candidate notes. You can do the same with harmony.

There is actually a famous program called CPU Bach by Sid Meier, who designed the Civilization series of games. There is a patent, now expired, in which he and his colleague explain one technique for creating Bach-like music.

There is also Cope who used a so-called recombinant method. He sliced up and then reassembled pieces of Beethoven to get a piece that sounded like Beethoven.

There is also a transition matrix based approach. Some pioneers in computer music analyzed the melodies of Foster and figured out the probability that a note or sequence of notes would be followed by a particular note. For example, the matrix would calculate that you follow A B by C 25% of the time, by D 12% of the time, and so on, depending on the composer's style. This is a crude approach but it did produce melodies reminiscent of Foster.

On a personal note, I realized that by programming algorithmic music, I came to regard human music as a rather pointless activity, and I lost all enjoyment of music for some time. So I abandoned algorithmic composition, and eventually became enough of a human again to be able to enjoy music. Do I care what music a robot brain generates? Not at all.

What is important for me is the human behind the music. For example, when I listen to an emotional song, it only interests me because of the human who created that song. If I knew the melody was generated by a computer, I would not enjoy it. Knowing that it comes from the creative impulse of another human being is part of the appeal. I would say the same about computer-generated art in general. I understand that significant intellectual effort went into it, but for me it has zero emotional appeal.

If a good melody is just a sequence of tones produced according to some algorithm, then I already have a program that can generate as many good melodies as you could ever listen to. So what? After a while it just becomes, to paraphrase Shakespeare, sound and fury signifying nothing.
 
Last edited by a moderator:
  • #17
Hornbein said:
I have been a musician for over 40 years and can tell you that no one knows the rules for producing appealing music. I doubt that any such exist.

I agree. What I learned when I did some music programming was that there is something that good musicians have, that allows them to compose, arrange, and perform music that is loved by other people. Sometimes it is so subtle, I can't explain it logically. I can't reduce it to some algorithm. The whole is greater than the sum of the parts. It is not just a simple set of rules. I know it when I hear it. It moves you, or it does not move you.

It's also subjective. My taste is not the same as others. It's not like math where everyone can agree that a calculation yields the right answer.
 
  • #18
Avatrin said:
Hi

What approach should I take if I want to try this with music?

I know the mathematics that are needed to learn neural networks (from what I have read on websites like Coursera). Also, I know basic scientific programming with Python.

I am willing to spend time to learn how to make the musical equivalent to the art above. What skills do I need?

I know SuperCollider is a programming language made specifically for music, but is it useful for this? The impression I get is that it will be hard to import music to it to make new music.

Yeah, I know it will probably take more than a year, maybe several years, to learn it all, but I am willing to spend the time to do it.

By the way, sorry to mention my personal feelings. I do not mean to be negative. I lost interest in some uses of AI. Also I have mixed feelings about music in general. But this is not relevant to your question.

I can definitely see some value in algorithmic music in certain contexts. For example, some people have created dance music using algorithms. I believe there have even been events where they play algorithmic dance music. If people enjoy this, then more power to them.

Also some video games have algorithmic music. You might look into this and try to find out how the algorithmic music in these games was coded. I would bet it was in C/C++, assuming the game was in C/C++.

My approach was to generate notes, as opposed to sounds, and then encode the notes in MIDI. Then I could play the MIDI file on a synthesizer of my choice. I only used software synths. I wrote some code in C and some in Lisp.

I could also generate a score from the note events. The language I used for this is available at lilypond.org.

One program I found useful was SynthFont because I could load a sound font of my choice into SynthFont and play the music that way.

I never wrote my own synthesizer for public release. However, I did develop a synthesizer for learning purposes, using techniques from Petzold's additive synth, from his book Programming Windows 5th edition. That is a good reference if you want to understand how to generate sound on a computer. He used C.

Petzold recreated some complex instrument sounds from old experiments on additive synthesis. I just made a simple organ synth by combining sine waves. This is the basic principle of the Hammond organs.

You will also learn from Petzold how to format a WAV file. Once you have a WAV file it's easy to convert it to MP3 using VLC for example.

If you want to work at the level of raw sound, as opposed to musical notation, then I suggest looking at CMusic. You could generate a score and even instrument specifications using your AI code. You are not restricted to what you can do with traditional music notation. I think this would be the most flexible approach. You can generate just about any sound you want. It may be helpful to search for CMusic and Max Matthews. I believe you can find open source in Lisp and perhaps C from this project. Or you can study the Matthews book and write your own implementation of his concepts.

As far as neural nets vs another approach, I have never used neural nets. I understand they are useful for pattern recognition. Obviously painting and music are quite different art forms. In addition to looking into neural networks, I would read the CPU Bach patent for another approach, and also some of the writings of Cope. Also to see another approach to algorithmic painting check out http://www.kurzweilcyberart.com/aaron/message.html. The Aaron developer used Lisp.

Another interesting site is http://www.music-cog.ohio-state.edu/Humdrum/representations/kern.html. This describes the **kern language they use to represent music for analysis purposes.
 
Last edited by a moderator:
  • #19
I think the hardest part of making a neural network deal with music is that each instrument sounds differently. An A on a guitar is not the same as an A on a horn. In fact, I can make several different A sounds on one guitar. A guitar string doesn't vibrate with one frequency, it has a main overtone and a whole bunch of undertones which are usually multiples of the overtone, but not exactly because of the density, material... That's a major reason why guitar music is written with tabs instead of notes. You'd have to train different nets for different instruments then have a deeper layer combine them.

I'm working on a neural network right now, they're training is difficult unless you can define exactly what you want to reward and suppress.

This article might be interesting to you http://qz.com/790523/daddys-car-the...ificial-intelligence-is-actually-pretty-good/
 

1. What is a neural network and how is it used in music?

A neural network is a type of artificial intelligence that is inspired by the structure and function of the human brain. It is used in music to analyze patterns and create new compositions or generate musical accompaniments.

2. How do neural networks learn and compose music?

Neural networks learn to compose music by training on a large dataset of existing music and then using algorithms to generate new compositions based on the patterns and structures it has learned. The network can also be fine-tuned by a human composer to achieve a desired style or mood.

3. Can neural networks create original music?

Yes, neural networks can create original music. While they may be trained on existing music, they have the ability to combine and manipulate patterns in unique ways to generate new compositions that have never been heard before.

4. What are some potential applications of neural networks in music?

Neural networks can be used in a variety of ways in music, including composition, accompaniment, arrangement, and even music recommendation systems. They can also be used to assist human composers and musicians in their creative process.

5. Are there any limitations to using neural networks in music?

While neural networks have shown great potential in music, they do have some limitations. They can only generate music based on the patterns and data they have been trained on, so they may struggle with creating truly original or innovative compositions. Additionally, they may lack the emotional and creative elements that human musicians bring to music.

Similar threads

  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
4
Views
601
  • Programming and Computer Science
Replies
5
Views
697
  • Programming and Computer Science
2
Replies
50
Views
3K
  • Programming and Computer Science
Replies
1
Views
903
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
5
Views
918
  • Programming and Computer Science
Replies
3
Views
875
  • Computing and Technology
Replies
4
Views
1K
Back
Top