Max Easy Pieces – Episode #1: SWARM

In this series I will create small Max patches to show how to generate unusual sounds or sequences; I will use non-trivial audio programming techniques, but this doesn’t mean they are complex or difficult to grasp (at least I hope so!).
Here is the “Easy Pieces Decalogue” I will follow:

1 – The pieces are realized exclusively with the standard Max MSP objects
2 – They use a minimum number of objects (no more than a few dozen)
3 – No subpatches, bpatchers or abstractions allowed
4 – No “J” (Jitter, Java and JavaScript) objects
5 – No audio plugins or hardware external generators. The only virtual instrument allowed is the virtual synth embedded in the computer OS.
6 – They are easy pieces, but not at all basic: they assume a fair Max MSP knowledge to be fully understood (though anybody can play with them, in many cases you only need to click a button)
7 – In every patch there is at least an unusual and/or interesting programming technique (I already said this, but I put it here to reach number ten…)
8 – They have a high quality/complexity ratio: i.e. with a handful of objects they create sounds interesting enough to be listened to for at least half a minute (!)
9 – They are very light for the CPU
10 – Each piece deals with completely different techniques

And here is the first patch: SWARMFirst of all take a look at this video where I build (live code) the patch:

It is small, isn’t it? Only 12 objects.
By the way, if you are too lazy (you shouldn’t!) to recreate it, you can download it from the bonus page for the newsletter subscribers (along with all the patches I will add in the future): check the link at the end of this post.

The most interesting thing in this patch is probably the feedback technique to modify the [metro] time interval: every time the [drunk] object on the right receives a bang from the [metro] object, it generates a value that is used to modify the [metro] time. Since the [drunk] object generates a random walk between 0 and 100, the [metro] object bang stream is continuously varied with accelerando and rallentando. The same random walk influences the note loudness: using the [!- 160] object connected to the velocity inlet of [makenote], for any accelerando we also have a crescendo, and conversely a rallentando also produces a diminuendo.

If I had used a [random] object in place of [drunk], I would have got sprays of notes with no clear direction.
The note pitch also is generated by a [drunk] object (right below the [metro] object): its first argument is 48; this means that the generated note pitches span over 4 octaves. The [drunk] second argument is -3, so the random walk steps may be 1 or 2 semitones, but not 0 (i.e. we don’t have repeated notes). For each value generated by [drunk] we actually hear 3 notes in 3 different registers: the first starts from C0 (MIDI value 24), the second from C1 (36) and the third from C2 (48). The highest pitches are also delayed by 1 and 2 steps by means of the [bucket] object: this creates a sort of octave canon. In other words, the patch doesn’t produce a stream of parallel octaves (as it would be without the [bucket] object), but mostly seventh and ninth vertical intervals (between simultaneous notes).

If you are fluent in Max you can modify the patch to get other interesting results: for instance you can change the parameters of the two [drunk] objects or the transposition of the three series of pitches, or rescale the streams with the [scale] object.

If you want to learn Max you can check out our book series Electronic Music and Sound Design, you will learn a lot of synthesis and audio processing techniques and have fun with Max!

And don’t forget to subscribe to the Virtual Sound Newsletter.

Subscribe to our Virtual Sound Newsletter to get Max and Sound Design tips and tricks and get access to the Bonus Material Page.