Showing posts with label beginners. Show all posts
Showing posts with label beginners. Show all posts

Saturday, 27 March 2010

Tutorial Max 1: Random Pitches In Max5

A few days ago we posted an introductory algorithmic composition example that generated random pitches in PureData. Today we're creating the same example in Max 5.

Max is a commercial application available from Cycling 74. Max is very similar to the opensource programme PureData, in today's example the patches are very similar, as we start to implement more advanced algorithmic compositions we'll discover some of the differences between the two programes.

Max is a commercial application, however there is also a limited time demo version available here.

  1. Start MaxMSP and create a new patch from the file menu [PC: CTRL N, Mac: CMD N]
  2. Now we need to start creating the patch, press 't' to create a toggle.
  3. Press 'n' to create a new object and type 'metro 1000' into this. This object is a metronome and sends out regular pulses. We have used 1000 as the argument, so our metronome will send out a pulse every 1000ms.
  4. Press 'n' to create another object and type random 12 into this object. This object is a random number generator. As we used 12 as its argument it will choose a random number from 12 possibilities (from 0 to 11)
  5. Add an integer number box by pressing 'i'. This is not strictly necessary but will display the random number that has been chosen.
  6. Add another object (by pressing 'n') '+ 48' (don't forget the space. This will add 48 to our random number to lift it into a sensible MIDI range.
  7. Add a further integer box, again not strictly necessary but will show the resulting number.
  8. Add a makenote object as per the screenshot. The other arguments included are velocity and duration.
  9. Add a noteout object and connect everything up as shown in the screenshot.
  10. Go to Options MIDI setup and choose a MIDI output.
  11. Exit edit mode [PC: CTRL E, Mac: CMD E] and click in the toggle box, you should see the number boxes changing values and hear random MIDI notes being generated.
Your patch should look something like this - click on the image to see a larger version.
Here are some things to try:
  • Change the value in the metronome box or connect a slider to the metronome's right inlet to generate notes at a faster or slower speed
  • Change the value in the random box to generate a larger or smaller range of pitches
You can also download the Max patch here.

Algorithmic composition can get a lot more interesting and involved than this, we'll look at some more advanced examples and other software in future posts.

Tuesday, 23 March 2010

Piano Phase | PureData

Steve Reich was an algorithmic composer. His composition Piano Phase (1967) involves two pianists playing an identical twelve note phrase, however one is played at a slightly faster tempo than the other.

Gradually as the piece progresses the two parts drift further out of phase with each and listening, you can hear new melodic fragments appear created by the combination of the two parts.

The 12 note phrase is:
E4 F#4 B4 C#5 D5 F#4 E4 C#5 B4 F#4 D5 C#5

or in MIDI notes:
64 66 71 73 74 66 64 73 71 66 74 73

If you want to implement the patch in Max there's another algorithmic composition post here.
Here is a PureData algorithmic composition patch that realises Piano Phase. Here's how the patch works:
  • The 12 note phrase is stored in a table object an labelled pianoPhrase.
  • Two metronomes with slightly different tempos send 'bang' pulses to counters.
  • These counters are connected to a tabread object, this object reads through our stored piano phrase
  • This is then sent out to a makenote and noteout object to create and output MIDI notes.
Here's a screenshot of the finished patch, you can view a larger version by clicking on the image.


As ever I recommend creating the patch yourself by copying the layout of the screenshot, however you can also download the patch here.

The good thing about creating a computer version of Steve Reich's algorithm is that it's easy to manipulate. If you want to try the same process with a different melody then alter the notes stored in our pianoPhrase message. If you want to try adding a 3rd part with a new tempo then it is easy to select and duplicate the necessary objects.

We'll implement some more of Steve Reich's compositions in future posts in PureData, Max, Lisp, OpenMusic and more..

Saturday, 20 March 2010

Tutorial - PD2: Random Major Scale Pitches

Following on from our last PureData tutorial that played random chromatic pitches, we'll make our patch a little more melodic by choosing our pitches from a major scale.

If you haven't already work through the last PureData algorithmic composition tutorial or download the PureData patch here.

Our last patch looked like this:


  1. Open our last patch from tutorial one. You can see the finished version of the patch at the bottom of this post.
  2. We'll store the pitches of our major scale in a message: create a new message [PD: CTRL 2, Mac: CMD 2] and type this is into the message ; majorScale 0 0 2 3 5 7 9 11 12
  3. This defines the intervals of a major scale. We need to store this in a table, create a new object [PD: CTRL 1, Mac: CMD 1] and type 'table majorScale' into this object box
  4. Come out of edit mode [PD: CTRL E, Mac: CMD E] and click on the message to store the scale to the table.
  5. We'll set the patch up so the scale is stored automatically when the patch loads. Enter edit mode [PD: CTRL E, Mac: CMD E]. Create a new object [PD: CTRL 1, Mac: CMD 1], type 'loadbang' into the object and connect it to the message.
  6. Break the connection between the 'random' object and the '+' object. Create a new object and type 'tabread majorScale' into this object.
  7. Optional: create two new number boxes [PD: CTRL 3, Mac: CMD 3] and connect everything up as shown in the screenshot below. The numbers aren't strictly necessary as they don't actually do anything, they just display the current number.
  8. Previously we were choosing from 12 random pitches. Now we only have 8 notes to choose from in our scale, so we now need to change the number in our random object to 8.
  9. Come out of edit mode [PD: CTRL E, Mac: CMD E], click on the toggle and you should hear random notes from the C Major Scale.


Remember to make sure you have set a MIDI output in preferences/Midi settings.

It's definitely worth building the patch yourself to get used to working with the program, but you can also download the patch here.

Wednesday, 10 March 2010

Tutorial - PD1: Random Pitches in Puredata

This is a simple tutorial example to generate random pitches. For this example we'll use a program called Puredata. It's free, runs on Macs, PC's and Linux and can manipulate MIDI, audio and video.
  1. Download puredata extended from www.puredata.info
  2. Start the program and create a new patch from the file menu [PC: CTRL N, Mac: CMD N]
  3. Now we need to start creating the patch, from the put menu add a toggle
  4. Again from the put menu add an object and type 'metro 1000' into this. This object is a metronome and sends out regular pulses. We have used 1000 as the argument, so our metronome will send out a pulse every 1000ms.
  5. Add another object from the put menu or use the shortcut [PD: CTRL 1, Mac: CMD 1] and type random 12 into this object. This object is a random number generator. As we used 12 as its argument it will choose a random number from 12 possibilities (from 0 to 11)
  6. Add a number box, either from the put menu or using the keyboard shortcut [PC: CTRL 3, Mac: CMD 3]. This is not strictly necessary but will display the random number that has been chosen.
  7. Add another object '+ 48' (don't forget the space. This will add 48 to our random number to lift it into a sensible MIDI range.
  8. Add a further number, again not strictly necessary but will show the resulting number.
  9. Add a makenote object as per the screenshot. The other arguments included are velocity and duration.
  10. Add a noteout object and connect everything up as shown in the screenshot.
  11. Go to preferences MIDI settings and choose a MIDI output.
  12. Exit edit mode [PC: CTRL E, Mac: CMD E] and click in the toggle box, you should see the number boxes changing values and hear random MIDI notes being generated.


Here are some things to try:
  • Change the value in the metronome box to generate notes at a faster or slower speed
  • Change the value in the random box to generate a larger or smaller range of pitches
You can also download the patch here.

Algorithmic composition can get a lot more interesting and involved than this, we'll look at some more advanced examples and other software in future posts.

Monday, 8 March 2010

What Is Algorithmic Composition?

What Is Algorithmic Composition?
An algorithm can be defined as “a set of rules for solving a problem in a finite number of steps”, (David Cope, 2000). Algorithms are instructions that are followed to complete a task. When composing algorithmically we write the instructions that will create the music rather than the musical notes themselves.

If you were to write a song or compose a piece of music, traditionally the composer(s) decide exactly what note is played where, for how long and on what instrument. You may have a plan in mind of what the finished piece of music will sound like, but work through step by step explicitly writing down each note on a piece of paper or recording it in a sequencer or multitrack recorder.

With algorithmic composition, rather than spelling out each note and instrumental part, you create an algorithm or 'set of rules' that will create the musical surface for you. Heinreich Taube describes this as composing at the metalevel.

Here's a simple example. If you were writing a song you might start by writing a chord progression. If you were to write a chord progression algorithmically, you would specify:
  • The list of chords that could be used
  • How often these chords could or would change
  • A way of choosing between these chords
  • How many chords you wish to generate
This could be choosing between the diatonic chords of C major twice a bar, for four bars and choosing the chords completely randomly, or choosing the possible chords that could follow the current chord.

Why Compose Algorithmically?
This brings us to a few of the benefits of being an algorithmic composer:

  1. Using computers, it's just as easy to generate 1000 chords as it is to generate 4.
  2. We can use the system to generate ideas for us, if we want we can discard those we don't like
  3. Once we've created the algorithm, we can tweak it to generate variations e.g. use a different set of chords or rhythm

This is a very simple example and is obviously quite limited. However it introduces us to some ideas that we'll look at in more depth in future posts.

Sunday, 8 November 2009

Algorithmic Composition

I'm an algorithmic composer, I write software that composes music. In this blog I'll be posting sample music together with tutorials, patches and lessons on how you can use computers to compose music algorithmically.

If this is new to you, don't worry. We'll be taking things from the ground up in small steps.

If you've composed music algorithmically before there will be lots of intermediate and advanced tutorials that walk through Markov chains, neural nets, chaos, fuzzy logic, stochastic, data driven approaches and more.

Lots of the concepts and ideas we'll discuss can be implemented on different platforms. I'll be reviewing free and paid-for software that can be used for algorithmic composition and posting lots of free downloadable example patches using Max, PureData, OpenMusic, LISP, Java and more.

You don't have to be a programmer to make algorithmic music, just an interest in creating music in new ways....