[CDP circles logo]

Return to Main CDP Documentation Index

A GrainMill Tutorial

Philippos Theocharidis

University of Newcastle

Full GrainMill version with support for breakpoint files

CDP would like to thank the University of Newcastle, Philippos Theocharidis and his tutor Agustin Fernandez for preparing this excellent tutorial and making it freely available to composers using GrainMill.

Table of Contents: Sounds, Texts & Project .grn Files to Load

In Release 5, these sounds are made and can be played right away. You can still load the settings and run the examples yourself, using horn.aiff or another soundfile (open it before loading the settings). When you SAVE the soundfile, you will be allowed to overwrite the existing one. If you use the same name, they will run from the HTML page.


The following tutorial is an introduction to the various transformations that can be achieved with GrainMill. A 5 second long horn sample is treated in various ways to illustrate possible types of output from the program, while explaining the effect specific parameter settings have on the sound.

GrainMill works by applying a process to each and every 'grain' of sound created. These grains are extracted from the source sound, processed, and reconstructed into a new sound.

IMPORTANT: Using the tutorial

In order to be able to listen to the sounds in this tutorial you first have to create them in GrainMill. This can be done by loading the equivalent .grn files provided, and running the program once for every sound.

  1. Create a directory named 'Tutorial' (or whatever) and copy to it all the files pertaining to A GrainMill Tutorial.
  2. After launching GrainMill select the directory named 'Tutorial' (or whatever you called it) as your working directory.
  3. Go to 'Open Soundfile' in GrainMill's FILE menu and select the source sound "horn.aiff".
  4. Load one .grn file (e.g wildphrase.grn) and press the MAKE IT button at the right bottom of the window.
  5. Wait for processing to take place. You now have the first sound.
  6. SAVE AS the resulting soundfile, using the name as in the tutorial.
  7. Go to the FILE menu and select "horn.aiff" from the list of most recently opened sound files.
  8. Repeat steps 3 to 5 for every .grn file in the directory.

You are now ready to use the tutorial.

Return to Table of Contents.

Section 1   –   Creating a phrase

Example 1.1   Transposition of grainsLOAD wildphrase.grn

In this example a wild phrase is played by a sax-like instrument which derives from transposing 60ms (or 0.06secs) grains of the original horn sample.

PITCH is randomly changed (using a range ) between values defined by two breakpoint files, pitchi1.brk and pitchlo1.brk. One ascends from almost no pitch shift to an octave higher while the other descends from zero transposition to an octave lower, widening the transposition range of grains with time, from zero to two octaves. Dynamic variation is also achieved using a range in the LOUDNESS value. The grains occupy the entire stereo field (SPACE range = L–R). The transpositions can be heard clearly as grains do not overlap considerably (DENSITY is 2) and the length of the sound stays the same because there is no TIMESTRETCH.

Return to Table of Contents.

Example 1.2   Effect of increasing the density of grains – LOAD blurphrase.grn

Slightly increasing DENSITY (to 5.8) will blur the sound. This is because there is some overlapping between grains.

Return to Table of Contents.

Example 1.3   Increasing the size of grains – LOAD slowphrase.grn

The tempo of the phrase can be controlled by the GRAINSIZE parameter (longer values will slow it down although this will also "play fewer notes" as there will be fewer grains). This will also have other side-effects as more of the original sound will be retained in each grain as in slow wild phrase where GRAINSIZE is 144.3ms (or 0.144 sec).

Return to Table of Contents.

Example 1.4   A bit of TIMESTRETCH – LOAD richphrase.grn

A richer, more sax-like result is achieved by increasing the TIMESTRETCH value slightly (to 1.34). Detail lost due to wide transposition is accounted for in this way.

Section 1 – Parameter Settings

Parameters wildphrase blurred wildphrase slow wildphrase richer wildphrase
TIMESTRETCH 1.00 1.00 1.00 1.34
DENSITY 2.00 5.85 2.00 2.00
GRAINSIZE 60.10 60.84 144.34 60.84
WANDER 0.00 0.00 0.00 0.00
PITCH pitchlo1 pitchi1 pitchlo1 pitchi1 pitchlo1 pitchi1 pitchlo1 pitchi1
LOUDNESS (dB) -46.64 -6.02 -14.30 -1.17 -14.30 -1.17 -14.30 -1.17
SPACE 0.00 1.00 0.00 1.00 0.00 1.00 0.00 1.00
DURATION 5.36 5.38 5.31 7.19

Breakpoint Data
pitchlo1 pitchi1
time (sec) transposition (semitones) time (sec) transposition (semitones)
0.00 0.00 0.00 0.47
0.67 -2.75 0.64 1.25
1.31 -4.83 1.31 2.13
1.78 -6.91 1.81 3.43
2.14 -9.30 2.25 5.19
2.60 -11.9 2.60 12.0

Return to Table of Contents.

Section 2   –   Varying the size of grains in time

Example 2.1   Variable grainsizes – LOAD mutantflies.grn

Lets now see the effect of a variable GRAINSIZE on a more or less pitched sound. A high enough DENSITY to produce phasing effects is used, which in conjunction with the small (1.2 semitones) range in PITCH gives this moving swarm of mutant flies.

Random LOUDNESS values also play an important part by creating a tremolo effect. SPACING is controlled by a single breakpoint file which moves the sound continuously from left to right and back while narrowing the field and finally ending at the centre.

Section 2 – Parameter Settings

Parameters mutantflies
GRAINSIZE 50.00 grainsize2
PITCH -0.6 0.6
LOUDNESS (dB) -39.69 0.00
SPACE space2

Breakpoint Data
grainsize2 space2
time (sec) grainsize (ms) time (sec) stereo position
0.00 20.0 0.00 0.00
0.61 25.0 0.80 0.98
1.57 48.1 1.27 0.13
2.15 130.9 1.90 0.78
3.04 500.0 2.02 0.28
2.39 0.55
2.63 0.34
3.04 0.43

Return to Table of Contents.

Section 3   –   Long grains, wide range of transpositions

Example 3.1   Constant PITCH range – LOAD metalnoise.grn

The horn sound turns to a metallic noise. PITCHSHIFT is set to a wide range so that pitch focusing is avoided. High values give this metallic edge. GRAINSIZE is long so that individual grains keep enough characteristics of the original sound but as they are "wildly" transposed, these are altered.

Return to Table of Contents.

Example 3.2   Varying the PITCH in time – LOAD horntometnois.grn

A horn-to-metalnoise sound can be achieved if transposition range increases with time so that initial grains retain their character.

An important feature in both of the above examples is the interaction of the TIMESTRETCH and DENSITY parameters. They are both controlled by breakpoint files. DENSITY becomes higher as the sound evolves (this can be clearly heard as sound "partials" are distinguishable in the begining as in Section 2). In this case however TIMESTRETCH has to be higher for as long as the DENSITY is low, due to the long GRAINSIZE (you run out of source sound length if you do not time-expand).

WANDER and LOUDNESS variation have the effect of making the sound harsher.

Section 3 – Parameter Settings

Parameters MetalNoise HornToMetnoise
TIMESTRETCH 0.5 tstretch3 0.5 tstretch3
DENSITY 76.11 density3 76.11 density3a
GRAINSIZE 352.35 352.35
WANDER 2.80 2.80
PITCH -12 34 -12 pitchi3a
LOUDNESS (dB) -54.61 0.00 -54.61 0.00
SPACE space3 space3
DURATION 2.52 2.52

Breakpoint Data
tstretch3 density3 density3a pitchi3a space3
time (sec) timestretch time (sec) density time (sec) density time (sec) transposition (semitones) time (sec) stereo position
0.00 3.96 0.00 3.88 0.00 3.88 0.00 7.73 0.00 0.93
1.35 1.58 0.35 10.58 0.85 15.19 2.35 16.45 0.36 0.50
1.99 0.78 0.55 20.11 1.46 32.42 3.49 32.57 0.70 0.05
2.27 0.43 0.76 39.52 1.97 56.73 5.39 34.55
2.52 0.19 0.90 60.68 2.52 77.97
0.99 77.97

Return to Table of Contents.

Section 4   –   Creating dense textures

Example 4.1   A dense reverberant sound – LOAD chaotic.grn

Lets now create a dense chaotic texture. The DENSITY has to be quite high for this. In this example DENSITY is set to randomly change (using a range) between 50 and 10. GRAINSIZE is 100 ms and these grains are randomly transposed within the limits of an octave.

Phasing effects are apparent due to the high DENSITY and long GRAINSIZE. Another important element in this sound is the reverberant effects. These are due to the same reasons plus the WANDER value that is set to 0 and the SPACE range (full Left to Right).

Return to Table of Contents.

Example 4.2   Effect of WANDER – LOAD harshchaos.grn

If we now change the WANDER value (to 1.37 secs) so that consecutive grains in the output are chosen randomly from this range in the input sound file we can see that we have lost these reverberant effects and that dynamic and timbral variation is enhanced making the sound harsher.


As WANDER is itself a range - the time range from which grains are randomly selected from the input sound - there is no range box to tick in GrainMill.

Return to Table of Contents.

Example 4.3   Effect of LOUDNESS – LOAD smoothchaos.grn

If we keep a constant LOUDNESS value instead of using a range in the first example in this section, then the effect will be a denser, smoother texture as each grain will have the same amplitude contribution to the phase cancellations produced by the large DENSITY.

Section 4 – Parameter Settings

Parameters Chaotic Harsh chaos Smooth chaos
TIMESTRETCH 1.83 1.83 1.83
DENSITY 10.15 50.43 10.15 50.43 10.15 50.43
GRAINSIZE 100.39 100.39 100.39
WANDER 0.00 1.37 0.00
PITCH -6.0 6.0 -6.0 6.0 -6.0 6.0
LOUDNESS (dB) -48.75 0.00 -48.75 0.00 -48.75 0.00
SPACE 0 1 0 1 0 1
DURATION 9.88 9.88 9.88

Return to Table of Contents.

Section 5   –   A combination

Example 5.1   Extensive use of time-varying features – LOAD brtopieces.grn

In this final example a piercing sound breaks down into pieces in brtopieces. Various parameters are controlled by breakpoint files either as a range or by a single file.

In the first part, (the piercing sound) grains are transposed almost 3 octaves higher. Pitchhi5.brk and pitchlo5.brk, the breakpoint files for the higher and lower limits of PITCH respectively, have small differences up to the point where the breakdown of the sound occurs. This actually happens because of the instantaneous change from 31.17 to -12.88 semitones in the transposition value in pitchlo5.brk while pitchi5.brk "stays" at high values. After a bump to around 44.61 semitones, the higher limit starts a downward glissando to 24.35 and the lower does the same to -17.32 semitones.

LOUDNESS is controlled by a single file amp5.brk which simply dies away after the breakdown and SPACE is given a range between spacehi5.brk and spacelo5.brk. The range is wide in the beginning, quickly moving the "pieces" to full Left towards the end.

TIMESTRETCH (controlled by tstretch5.brk) is initialy constant at 1.9 and then moves to 6.7 at the end, and DENSITY (breakpoint file density5.brk) changes throughout, taking values between 3 and 16. As the GRAINSIZE is small (18.36 ms or 0.018 sec), individual grains can just be heard at points with lower density in the first part of the sound. The combination of the later two parameters and the small variations in PITCH produce this slowing down/accelerating effect.

Section 5 – Parameter Settings

Parameters brtopieces
TIMESTRETCH 1.85 tstretch5
DENSITY 8.92 density5
PITCH pitchlo5 pitchi5
LOUDNESS (dB) 0.0 amp5
SPACE spacelo5 spacehi5

Breakpoint Data
tstretch5 density5 pitchlo5 pitchi5 amp5 spacelo5 spacehi5
time (sec) timestretch time (sec) density time (sec) transposition (semitones) time (sec) transposition (semitones) time (sec) amplitude (0-1) time (sec) stereo position time (sec) stereo position
0.00 1.85 0.00 8.27 0.00 31.41 0.00 34.09 0.00 0.99 0.00 0.26 0.00 1.00
3.61 1.85 0.62 14.77 0.39 28.95 0.59 34.87 0.56 0.90 0.93 0.28 1.53 1.00
5.94 1.86 0.97 3.09 0.73 30.89 1.17 33.70 1.08 0.99 1.54 0.27 2.41 1.00
8.10 6.72 1.36 5.45 1.20 28.40 1.65 36.04 1.78 0.99 2.11 0.26 3.03 0.32
9.92 6.72 1.46 16.71 1.70 30.34 2.18 33.70 2.53 0.93 2.87 0.22 4.11 0.14
1.99 11.33 2.18 31.17 2.82 34.09 2.98 0.41 3.57 0.17 5.39 0.03
2.77 7.67 2.18 -12.88 4.52 44.61 3.64 0.13 4.35 0.10
3.47 10.14 3.37 -12.91 5.80 44.61 4.17 0.03 5.39 0.00
4.01 10.42 4.74 -12.88 6.54 37.40 4.65 0.02
4.84 16.56 5.39 -17.32 7.53 24.35 5.00 0.00
5.41 8.86 5.39 0.00
6.40 5.89

Return to Table of Contents.

Activating a Range

In general, a range is activated by:

The relevant parameter then changes randomly between the upper and lower limits defined in this way.

You can return from this note with your Back Button

Return to Main CDP Documentation Index

Last Updated: 18 November 1998
Release 5.0 note at beginning, 19 May 2005
22 November 2005 (.aiff file extensions)
Author: Philippos Theocharidis
Minor proofing & layout edits, Archer Endrich: 8, 15 & 16 January 1999; 21 July 1999
Institution: Music Department, University of Newcastle Upon Tyne
E-mail: Philippos.Theocharidis@ncl.ac.uk