28
votes

I'm a beginner in music but I also like to fool around with simple computer programs . So I found a little python library to generate MIDI files . So what I do now is that I have a few rhythm signatures or time delays which I've fed in along with a few scales like the major , minor , blues . So I randomly step around the scales in step with the pre - fed rhythm signatures . I'm just looking for some tips from you guys on where I can go from here , what techniques I can use . Also if there are any mistakes or oversights in my present approach. This is my first question here , I hope you guys wont close this question as being too open ended or vague .

EDIT : This page makes for a fascinating read but is short on technical details http://www.psmag.com/culture/triumph-of-the-cyborg-composer-8507/ I have been searching for a few weeks on computer music and the page has some sample tracks as well . This is the best that has been achieved in algorithmic composition to the best of my knowledge.

EDIT 2 : This answer was very helpful .Thanks jadarnel27!
How can I generate nice-sounding random chord progressions?

EDIT 3: This is a pretty impressive demonstration of algorithmic composition
http://computoser.com/ Here is the paper+source code for it.

10
  • 1
    Well, I'm kind of afraid the question is a little too open-ended. This site works with a Q&A format, as you may know. Because this question is so open-ended, no answer is more right than another. That makes it not that great of a fit for this site's format. However, if you do have any objective questions, feel free to ask!
    – Luke_0
    Commented Nov 4, 2012 at 14:06
  • 6
    I think this should stay open. It's about techniques for composing music, which seems to me to be well within our guidelines for musical practice and performance.
    – user1044
    Commented Nov 4, 2012 at 19:15
  • 3
    You might be able to mitigate the open-endedness somewhat by reducing the vagueness. Show a little more of what you're doing. What are your rhythm signatures? What kind of results are you getting? ... Try different random number generators (particularly the bad ones), and expand the "steps" into randomly selected two- or three- note figures. Commented Nov 4, 2012 at 19:50
  • 2
    Any useful algorithm should be adaptable to different time signatures and scales. Perhaps we could make this a one-algorithm-per-answer community wiki?
    – naught101
    Commented Nov 5, 2012 at 8:00
  • my problem with the question is the word "random" it does not define goals , do you want produce historically or experimental music ? scales are just some tools like math they doesn´t do much alone, techniques aren´t musical.. define your goal.... do you want to learn about scales in western music? Commented Nov 8, 2012 at 22:47

7 Answers 7

24
votes

Max

has been around for 20 years.

Max gives you the parts to create unique sounds, stunning visuals, and engaging interactive media. These parts are called ‘objects’ – visual boxes that contain tiny programs to do something specific. Each object does something different. Some make noises, some make video effects, others just do simple calculations or make decisions. In Max you add objects to a visual canvas and connect them together with patchcords. You can use as many as you like. By combining objects, you create interactive and unique software without ever writing any code (you can do that too if you really want to).

Are you aware that algorithmic composition is something that started centuries ago, in one form or another? In recent years, algorithmic composition has received a lot of academic study.

There is a Wikipedia article on Algorithmic Composition. The article itself provides a cursory overview of this field. It doesn't have a lot of practical information but it has a bibliography that you could use to look for more information.

The Wikipedia article also provides a long list of commercial and open-source music software apps for algorithmic composition. It would be worth your while to try some of those and see what you can learn from them. Some of them are for creating avant-garde experimental music, and some of them, like Band in a Box, are for composing recognizable mainstream jazz. There is a modular toolkit for algorithmic composition with a graphical user interface called Max which is in use all over the world, particularly in academic circles.

As an interesting aside, Wolfgang Amadeus Mozart published an algorithmic music system in 1787, called the Musical Dice Game. It involved arranging musical phrases (composed by Mozart himself) in different combinations according to the roll of dice and a set of rules. This comes under the category of what is referred to as stochastic composition. You can Google "Mozart musical dice game" for more references. Here is one reference worth reading.

Other topics to look into from the pre-computer era would be aleatoric composition (championed by the 20th-century composer John Cage) and 12-tone serial composition (championed by 20th-century composer Arnold Schoenberg and explored by many other composers since then). Many pieces (most of them extremely dissonant and atonal) by these composers are now in the standard repertoire of 20th-century classical music.

4
  • 1
    Fascinating answer. I had no idea so much research went into algorithmic composition before computers exist, and I'm excited to try Mozart's dice game! Commented Nov 6, 2012 at 19:27
  • Are fractals any good ? I dont find their output to be any better than random . Mozarts dice game is pretty amazing.
    – coderboy
    Commented Nov 7, 2012 at 15:57
  • Thelonious Monk would sometimes play something random and then work to resolve it and make it part of his solo.
    – Stinkfoot
    Commented Oct 7, 2017 at 0:11
  • From what I've read, the Mozart dice game involves several (minuet-like) pieces with the same length and roughly the same chord progression, ripped into individual measures and strung together by dice rolls. I've heard of a Haydn dice game, too.
    – Dekkadeci
    Commented Oct 7, 2017 at 15:49
9
votes

well, what I've done so far (I'm prototyping in perl and if it's useful, moving it to c++) is make chord progressions following this: http://mugglinworks.com/chordmaps/part5.htm

Giving the chords a certain number of beats,

And putting the chords into certain rhythm arrangements that'll still fit a real pair of hands. As in http://www.scribd.com/doc/102512170/Playing-Pop-Ballads#

That's as far as I've got. But there is a world of possibilities if ya ask me.

7
votes

I also recommend looking into Supercollider

SuperCollider is an environment and programming language for real time audio synthesis and algorithmic composition. It provides an interpreted object-oriented language which functions as a network client to a state of the art, realtime sound synthesis server.

It is open-source, with good community support and powerful compositional and synthesis methods.

3
votes

You mention that you are really impressed with http://computoser.com/, but that you didn't know the author's techniques. Here's the underlying code (not mine) on Github: https://github.com/Glamdring/computoser

3
votes

For a Pythonic option, have a gander (or goose) at SCAMP (Suite for Computer-Assisted Music in Python).

I've actually linked to a post in the active and friendly forum, which links to the documentation for the package.

Most of the users that I've encountered in the forums and in a class I took -- including the creator of the package -- are writing algorithms to generate music programmatically.

Quoting the package's documentation:

SCAMP is a computer-assisted composition framework in Python designed to act as a hub, flexibly connecting the composer-programmer to a variety of resources for playback and notation. SCAMP provides functionality to manage the flow of musical time, play back notes via SoundFonts or MIDI or OSC messages to an external synthesizer, and quantizes and exports the result to music notation in the form of MusicXML or LilyPond.

The really helpful 34-minute introductory tutorial video on YouTube begins with the statement:

"... Most algorithmic composition tools dedicate themselves mostly to sound synthesis, or music notation. The goal of SCAMP is to incorporate both into a single workflow, and to do so in a way that connects the composer to their other resources for playback and notation."

Installation is a mere

pip install scamp

away.

FWIW: The creator of the package, Marc Evanstein, holds a PhD in composition and a master's in Media Arts and Technology, and wrote SCAMP as part of his master's requirements.

0
1
vote

Adding to the list of tools to help newcomers feel comfortable with the idea of composition - check out SonicPi! It's a full fledged composition and performance tool used by gigging musicians, but with the primary goal of being an amazing platform to teach kids (>=10 years old) how to code!

-5
votes

My opinion is that you can not use music theory for music composition to create some algorithms that produce music understandable by humans. My view (opinion) is that I should not look at music composition like a programmer; a programmer does a very different job. Like in number theories, you can create patterns with Algorithms, but does it sound great? does an arpeggiator sound great? Sure, but is it composing something? Why are some piano players great and some not so great if they are playing the same notes? Music works on so many layers that until now, no music instrument builder has developed a Turing machine-like approach like they have in computer science.

I think Algorithm composing is the wrong tool for this job.

  1. Experimental music

You do not want to make music that's based on something that's not new or known to us and an Algorithm could only work with known solutions (Determinism problem).

You cannot prove some thing in music; music has no right or wrong state. What is the right state in music? How can an Algorithm prove that it has produced a good music piece when the problem is deeper. Music is an experience thing without meaning; it is like feeling something. Until now, we do not have some thing like AI. All we got are some pattern recognition algorithms that can see patterns; you can't make music without Consciousness.

  1. Historical music (pop music pattern , rock, techno , baroque, etc.)

There are known pattern for this music. Music theory is not something that is creating those patterns; music theory is more an analytical approach.

Maybe I can recommend you the book of Roger Penrose, "The Emperor's New Mind"

Penrose presents the argument that human consciousness is non-algorithmic, and thus is not capable of being modeled by a conventional Turing machine-type of digital computer.

I think consciousness is a Precondition to create human understandable music or you can not produce Culture without the human factor.

Well, I'm not sure if you can get my point.

To shorten it up:

Music theory is more an analytical approach, but you have to have some data to analyse (limits of music theory -> lack of Creativity)

Know the limits of an Algorithm (like http://en.wikipedia.org/wiki/Entscheidungsproblem)

If you know these limits, you can get good tools to produce.

6
  • Please read this psmag.com/culture/triumph-of-the-cyborg-composer-8507 and tell me if you still hold the same opinion
    – coderboy
    Commented Nov 10, 2012 at 19:29
  • 1
    bad example of Algorithms for music composition tones.wolfram.com/generate Commented Nov 10, 2012 at 22:50
  • 2
    As a programmer learning to compose, the whole point of exploring algorithmic composition is not to replace the composer, but to better understand music, human perception, the basic rules and some of the principles and workflows used by composers to create music. Given enough algorithms and guiding rules used by composers to explore, I might finally be able to come up with my own understanding of what works and what doesn't, and perhaps be able to devise my own workflows and principles of composition.
    – JBeurer
    Commented Jan 7, 2013 at 19:01
  • 2
    -1 While I agree that music is art and composers cannot be replaced by machines, creating an algorithm to generate music is itself a form of composition, and one that, as the other answers can attest, is receiving quite a bit of attention.
    – Kevin
    Commented Feb 17, 2015 at 0:13
  • 1
    Most music is algorithmic by definition. That doesn't mean that the greatest works of art are produced mechanically, but algorithms are the building blocks of music, so Sir Penrose is irrelevant to the discussion. Algorithms alone will not create great music, but they can provide a good start and be used to generate listenable, pleasing music. All musicians are subconsciously mathematicians - Thelonious Monk
    – Stinkfoot
    Commented Oct 7, 2017 at 0:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.