views:

310

answers:

4

I'm interested in automatic music making. I was thinking about a program that is fed a large number of 1-bar arpeggios (= fixed length sequences of notes, for simplicity) and generates its own sequences, based on what it learnt.

To start with, I know I could use letter (digram? trigram?) frequency analysis, only applied to note pitches, and then generate my sequence based on frequency probabilities.

Are there more advanced algorithms you know of, maybe expressly taught for music sequences?

+2  A: 

Statistical analysis of existing leads to music that is -- well -- average. There's rarely anything interesting because it tends to reproduce all the common features of whatever you analyzed.

Music is multi-dimensional. You can, clearly, analyze any or all of the dimensions that interest you. Pitch, tempo, sequence of notes, harmonic progressions, volume changes, anything. Everything.

Music is subtle and complex so there's always something more to analyze.

AFAIK (my son is a composer) what's more interesting is to invent your own unique algorithm for generating music that's reasonably distinctive.

Here's something my son specified. It generates a sequence of 48 musical events that the piece is built around.

#!/usr/bin/env python
"""
there are 8, 3-note sets.
each one can occur on 3 different beats.
each pitch of the 3 note set can be in one of 3 octaves and it can either be a harmonic or a fingered note.
"""
import random

noteSetChoices = [ "C-E-G", "C-F-A", "C-E-A", "D-F-A", "D-F-B", "D-G-B", "E-G-B", "F-A-C" ]
beatChoices= [ "1 - - -", "- 2 - -", "- - - 4" ]
octaveChoices= [ 1, 2, 3 ]
techniqueChoices= [ 'Fingered', 'Harmonic' ]

for n in range(48):
    note= random.choice(noteSetChoices)
    beat= random.choice(beatChoices)
    octave= random.choice( octaveChoices )
    technique= random.choice( techniqueChoices )
    print octave, note, technique, beat
S.Lott
How is the music on Spore? I'm pretty sure that music is auto generated.
Spencer Ruport
Mmmmh, this means you already know genre canons, and you don't extract them from other songs.
janesconference
@janesconference: I don't know squat, actually. I'm a bass player, so I understand a little; my son's the composer.
S.Lott
+4  A: 

The Wikipedia article on Algorithmic Composition is an excellent primer. It describes some of the models used for algorithmic music creation, notable composers, book references, and algorithmic composition software.

http://en.wikipedia.org/wiki/Algorithmic_composition

Robert Harvey
+2  A: 

Being a musician myself and a Software Engineering major, I htink I can shed some cool light here :P I've done a lot of work on the subject myself and plan on making something big based around this in the future.

When you write an algorithm, your goal is to come up with a solution- fore example, in sorting problems it's to have a sorted list. In algorithmic music composition, the solution is (usually) to have a song, or melody that is pleasing, has structure, etc.

The problem with the solution (hah) is that it is not only objective, but the solution is vastly open ended. With a sorting algorithm, you have only one way to sort a list. With music composition, you have millions of pleasing songs/whatevr your goal is.

So you will need an algorithm that is good for not finding definitive solutions, but OPTIMAL solutions. My suggestion is a genetic algorithm or similar. Genetic algorithms are great because they can create a pool of various optimal solutions.

You'd need to break the composition into parts- have a GA for melody, GA for rhythm, GA for structure, etc. And design your fitness function to fit your needs.

Of course this is only one solution to the problem; there are many and the wikipedia link listed before is a great start.

I recommend checking out: GenJam: an improvisational jazz Genetic Algorithm designed to trade solos- http://www.it.rit.edu/~jab/GenJam.html

And this book is very enlightening: http://www.springer.com/computer/information+systems/book/978-1-84628-599-8

I suppose another fun way would be with neural networks....but giving them sets woud be a bit of an issue probably....it's a lot more work.

Anyways, Good luck in your ventures :P

RyanCacophony
Also, studying music composition and harmony will go a long way to help you design fitness functions :D
RyanCacophony
A: 

It really helps if you know conventions of music, so read books and articles written to teach humans how to compose songs. You'll get great ideas.

Throw some pedal point in now and then to build tension. Use the age-old technique of call-response between two different instruments.

Nosredna