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.

1 comment:

Anonymous said...

hey mate just wanna say, nice one for doing this. best lot of tutorials i have found on the subject. thanks a lot!

Post a Comment