Granular synthesis is an extremely versatile technique to create sounds closely associated with the world of electronic and computer music.
In this project, you will experiment with some of the possibilities by creating 4 directed examples and a short but open-ended composition.
We will introduce two techniques: Grains from sound files, and synthesized grains.
p4.zip
p4.zip
contains everything you need to get started. You might begin by loading proj4base.sal
file, which should process the included sample.wav
. See the .sal
code for documentation on how it works. As is, proj4base.sal
uses file-grain
to produce individual grains and make-granulate-score
to make a Nyquist score consisting of many grains.proj4base.sal
to proj4.sal
, which you will hand in.proj4.sal
to granulate your sound. Note how the code references sample.wav
as "./sample.wav"
. The "./"
means “in the current directory”; otherwise, Nyquist will look in the default sound file directory, so be sure to use the "./"
prefix to reference your sound file, and put your sound file in the same directory as proj4.sal
.In the following work, you are encouraged to read make-granulate-score
in proj4base.sal
to understand it and modify it as you wish. Automatic grading is based on the computed score, which must be stored in *granulate-score*
(this is already done in the provided code).
proj4.sal
define the function part1()
that will produce a granular synthesis sound (taking grains from your chosen sound file) with the following parameters:
proj4base.sal
‘s make-granulate-score
function, but you might also like to hear a less scrambled time-stretch effect by setting randomness to 0.play part1()
should play about 3s of sound.sound
behavior makes a sound stretchable and shiftable. Grain is already in an environment with a stretch factor and the stretch factor has already been applied to compute grain, so if we just wrote sound(grain)
or sound(grain) ~ 1.5
, the current environment stretch factor would be applied again – not good. Instead, we use “absolute stretch” (~~
) to replace the stretch factor in the environment with an absolute value while evaluating stretch()
. The result is that the grain is resampled to make it longer or shorter, depending on the value of the stretch factor. Find the expression (sound(grain) ~~ (1.0 / speed)
in the function file-grain
to see how this works in the code.proj4.sal
modify make-granulate-score
to accept a speed:
keyword parameter (default value 1) that passes the speed
value through the score to calls on file-grain
so that you can control the pitch shifting of grains.proj4.sal
define the function part2()
that will produce a granular synthesis sound (taking grains from your chosen sound file) with the following parameters:
proj4base.sal
‘s make-granulate-score
function, but you might also like to hear a less scrambled time-stretch effect by setting randomness to 0.play part2()
should play about 3s of sound. The sound should of course be an octave higher (but the same duration) as in Part 1.make-granulate-score
function includes a density
parameter that gives the probability (from 0 to 1) of appending any given grain to the score as it is constructed.proj4.sal
define the function part3()
that will produce a granular synthesis sound (taking grains from your chosen sound file) with the following parameters:
play part3()
should play about 3s of sound. The sound should be about the original pitch of your sound file, but the sound should be stuttering or pulsing irregularly with short grains of sound.proj4.sal
, modify make-granulate-score
to accept another parameter to select synthesized grains. E.g. you can add a boolean parameter sinegrain
(default #f) to enable calling sine-grain
instead of file-grain
. Alternatively, you could provide the name of the grain function to use in a parameter to make-granulate-score
, e.g. grainfunc
(default quote(file-grain)
).make-granulate-score
should be different when synthesized grains are selected. The function sine-grain
is already (partially) implemented, and has two keyword parameters: low
and high
. In make-granulate-score
, you can put these parameters into the score, or you can just use the default values.sine-grain
to randomly choose the pitch to synthesize, based on the keyword parameters low
and high
.proj4.sal
define the function part4()
that will produce a granular synthesis sound using synthesized grains with the following parameters (which are otherwise the same as Part 1):
play part4()
should play about 3s of sound. The sound should consist of clean, rapid, bubbly sinusoidal sounds with a diversity random pitches.At this point, since you have modified proj4.sal
for each part of the project, you should go back and test part1()
, part2()
, part3()
and part4()
to make sure they all still work as expected. Merely loading proj4.sal
should not play sounds automatically.
Copy your proj4.sal
file to proj4comp.sal
so that you do not “break” anything in Parts 1-4.
Using all the tools that you have built, create a 20- to 40-second composition. In your piece, you should at least include:
You may wish to alter your code further to incorporate amplitude and pitch control. Pattern generators are an excellent way to get some control over variations in parameters. You should also experiment with other parameters. In fact, ALL parameters should be considered fair game for experimentation. Shorter and longer grains have a very different sound. Very high stretch factors, very small ioi, and other changes can be very interesting, so please spend some time to find amazing sounds.
You are also free to make many granular synthesis sounds and mix them in Nyquist or in an audio editor such as Audacity.
Create the plain text file proj4comp.txt to explain:
Grading will be based on meeting the technical specifications of the assignment:
part1
, part2
, part3
and part4
functions in your proj4.sal
.proj4.sal
code should not immediately compute sounds.Please hand in a zip file containing the following files (in the top level, not inside an extra directory). Note that the following must be strictly adhered to:
proj4.sal
part1.wav
,
part2.wav
, part3.wav
and part4.wav
.
proj4comp.sal
, Note: Code should be clearly commented in case we want to run it.proj4comp.wav
(or .aiff
).part1()
, part2()
and part3()
will run.sample.wav
from p4.zip
! It should not be needed to run your code, and we do not need another copy from every student, thank you.proj4comp.txt