Exercise 8

Exercise 8: Granulation

To granulate a sound is to break it up into many tiny grains — each anywhere from a few milliseconds to about a half second in duration. Each grain is encased in an envelope and can be independently transposed. The grains flow out of the granulator in one or more streams, one grain after another. The time between successive grains determines the grain rate, which has a profound impact on the sound. If the grain rate is regular, you may hear a pitch with a frequency corresponding to the time between successive grains. If the grain rate is randomly varied, this pitch disappears.

Why would anyone want to granulate sound? The applications range from time-scaling audio to making a sustained sound out of a short snippet (e.g., a choral sustain from a guitar pluck) to creating interesting noisy or pulsed repetitive textures. Play with it and see.

While Max is a (mostly) closed-source commercial application, many people have developed externals that you can add to Max to extend its capabilities. (“External” is a term used for the individual objects you drop into your patch.) Most of these are provided with the Max application, but you can add others.

We will use one such external, jg.granulate~, to perform granulation on audio stored in a buffer~ object.


We’re learning how to...

  • install the jg.granulate~ external,
  • associate it with buffer~ and waveform~ objects, and
  • use this set of objects to granulate sound, producing a variety of colors and textures.

How to Do This Exercise

Working on the assignment is a three-stage process.

  1. Install the jg.granulate~ object. To do this, download jg.zip, unzip it, and drag the “jg” folder into the appropriate package folder (‘~’ means your home folder):

    ~/Documents/Max 8/Packages/

    ~\Documents\Max 8\Packages\

    You may need to relaunch Max, so that it can find the jg.granulate~ object contained in this package.

  2. Download Exercise 8 Max Tips. This folder of Max patches gives you a few examples of granulating sound using jg.granulate~.

    In addition to studying these patches, consult the jg.granulate~ help patch to see another example and a comprehensive list of the messages that jg.granulate~ understands. (Alt-click on the object to see its help file.)

  3. Make a patch that granulates audio, and store a few presets that capture parameters for contrasting sounds.

    See the Requirements section below for details.

Be sure you understand what each of these Max objects does:

  • buffer~
  • waveform~
  • jg.granulate~
  • pak
  • rslider


  • Make a folder for your exercise, and save an empty patch file into it. Close and reopen this file; then build your patch in it.
  • Copy a few short sound files into your patch folder.
  • Make a buffer~ object with a name as argument, and load one of your sound files into it. Use the replace message to buffer~ to load the file and size the buffer to the length of the file. Without an argument, replace opens a dialog in which you can choose a sound file. Instead, you can give the name of the sound file as an argument to the replace message. The file should be in the same folder as your patch.
  • Make a waveform~ object, and in the Inspector, set its buffer~ Object Name to the name of your buffer~. Also set its Click Mode to “Select.” This will let you select parts of the waveform to granulate. See the Tips patches to learn how to do this.
  • Make a jg.granulate~ object with two arguments: the name of your buffer~ object and “2,” to indicate the number of output channels you want.
  • Add float number boxes to control parameters and a preset object to capture their values.
  • Make some presets that create any five of the following kinds of sound. (Relevant jg.granulate~ parameters listed in parentheses.)
    • a time-scaled version of the original sound that lasts four times as long and sounds as smooth as you can make it (trav, rate, durrange);
    • a fast backward version of the sound (trav, rate);
    • a version that captures the timbral evolution of the sound in extreme slow motion (trav);
    • a “frozen” sound that can last as long as you need it to, while the sound cursor sits on one spot in the original sound file (trav=0);
    • a noisy, radio static-like sound — hints: very short grains (durrange), irregular grain onset times (outjitter);
    • a stream of pulsed sixteenth notes made with grains pulled from random places in the buffer (low rate, injitter);
    • a swarm of angry bees (transjitter);
    • bees arpeggiating a harmony (transcoll)
  • If you’re looking for another challenge, try recording into your buffer while granulating it. To do this continuously, use the loop message to record~, setting it to 1 or 0 to start or stop looping through the buffer while recording. Playing the buffer will sometimes produce clicks or other glitches. (The real solution is to use several buffers and alternate between them, so that jg.granulate~ is not trying to read from a buffer that you’re recording into.)

    This last step is optional!


  • Be sure you satisfied the criteria listed above.
  • Submit your Max patch in Canvas.

Grading Criteria

This exercise is graded pass/fail. You must submit the exercise by Thursday midnight to be eligible for a pass.

Your patch must

  • operate correctly and
  • implement the functionality described in the “How To Do This Exercise” section above.