top of page

Basic Generative Music in Pure Data

Today we're going to dive into generative music in Pure Data. We'll be going over...

1) Pick a set of notes to choose from.

2) Program it all with basic synth sounds.

3) Create a random generator to pick generate a simplistic melody.

This is to get us started. The patch we create won't really sound good, but it's a start.

Which Notes to Choose?

The easiest place to start is the minor pentatonic scale. This will ensure that pretty much any kind of note combination will work and nothing will sound too jarring. This is because there are leading tones in the pentatonic scale which would naturally require resolution. We'll be using A minor pentatonic for this example.

How you get exact notes is a little tricky. You'll need to know the midi number for the notes you want. If you have a midi keyboard, you can set this up to easily tell you what not you're playing.

If you don't have a midi keyboard, you'll have to look them up. To make things simple for you, the notes we'll be using are: 57, 60, 62, 64, 67 & 69

Then, you'll want to create messages for each individual note.

Creating a basic Synth

We'll be using a basic sine wave synth for this tutorial. It sounds very boring but we'll get to more interesting sounds in later tutorials.

First, create the ever-handy mtof object. This stands for midi-to-frequency and will take your Midi notes and convert them to their appropriate frequencies. It'll then be passed into the osc~ objects for a basic sine wave and then to a *~ and volume slider to a dac~. Connect all of the messages to the mtof object.

Note: Make sure you edit the properties of the volume slider to go between 0 - 1. The default is 0 - 127 and it will destroy your speakers or potentially harm your ears!

Random Generation

Here's where we get into the fun stuff. Lets start by creating a Metro Object followed by 250.

This will send out a bang message every 250 milliseconds. Add a Trigger going into it to turn it on and off.

Then from the metro will create a Random Object with the number 6. When this object receives a bang, it will output a number between 0 - 5 (because in programming land, you start counting at 0).

Then we want to create a Select (or Sel) Object with the numbers 0 through 7 following afterwards. This will create 8 outputs, the first seven corisponding to the different selections and the last one is...something else (doesn't matter).

Then have the first 6 outputs go into on of our Midi Note Messages that we made earlier. Should look like this...

This is what happens

The Metro Object sends out a bang message every 250 milliseconds. The Random Object recieves the bang and outputs a number between 0 - 7 to the Select Object. The Select Object recieves that number and then outputs a bang to the corisponding output. This bang then goes to the Midi Message, which is converted to frequencies and then makes a sound!


bottom of page