Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programming a Self Learning Music Maker [closed]

I want to learn how to program a music application that will analyze songs.

How would I get started in this and is there a library for analyzing soundwaves?

I know C, C++, Java, Python, some assembly, and some Perl.

Related question: Algorithm for music imitation

like image 807
Mylo Avatar asked Aug 28 '09 03:08

Mylo


3 Answers

Composition and analysis of music by computer is a huge field. There are two basic areas in this type of work, which overlap somewhat.

  • Algorithmic composition is concerned with the generation of music. This can be based on statistical approaches such as Markov chaining, mathematical models employing fractal or chaotic processes, or leveraging techniques from AI such as expert systems, neural networks and genetic algorithms.
  • Music information retrieval is concerned with identifying common grammars, commonalities and similarity metrics between pieces of music, and identifying uniqueness (sometimes called acoustic fingerprinting).

Many, many libraries, tools and specialised programming languages exist which can help with different parts of these problems. Here's a list of music-related programs and libraries for Python. There is a lot of technology available; you should be able to find something that will do the brunt of the work for you. Reimplementing a 'musical parser' through very low-level frequency analysis tools such as Fourier Transforms, as other answers have suggested, while possible, will be quite difficult and is almost certainly unnecessary.

For further advice and specific questions, the International Society for Music Information Retrieval has a mailing list which you would probably find very helpful.

like image 135
ire_and_curses Avatar answered Nov 06 '22 16:11

ire_and_curses


Once you get past the FFT stuff that Lennart mentioned, you might want to have a look at Markov chains for analyzing intervals between notes, and aggregated patterns.

This is kind of treaded ground, but Markov chains have been used in the past to build a kind of statistical model of melodies from various songs which can be used to generate new melodies. Markov chains can do the same with written english sentences. For an example of how that looks, have a play with the megahal chatterbot to see how markov chains can produce mangled output that statistically looks like its input (in megahal's case, it looks like english sentences)

You could concievably mash up the top 100, and have a markov chain generator blast out the next big hit.

On the other hand, you may want to consider the possibility that it is not any quality of the music itself that makes a song popular. Or perhaps it is a quality of music issue combined with marketing.

like image 30
Breton Avatar answered Nov 06 '22 16:11

Breton


To analyze soundwaves you need some sort of fourier transformation (fft), so you can split the song up into it's frequencies and how they change over time. There exists fft support in numpy, I haven't used it, so I don't know if it's any good. But it would be a great place to start.

After that you then need to make some sort of statistical analysis on frequencies and patterns, and then I no longer have any clue what I'm talking about.

Cool stuff though, go for it!

like image 26
Lennart Regebro Avatar answered Nov 06 '22 15:11

Lennart Regebro