Granular synthesis is a tool that takes a sound and chops it into little pieces. Each piece has its own window and can potentially have its own panning, duration, silence and transposition. Granular synthesis in music is analogues to pointillism in painting. Granular synthesis ca also be seen as a cloud of small fragmented sound akin to throwing a handful of sand into the air and each piece of sand is a sound. There are many ways to design a granular synthesizer. In this short post I will demonstrate one simply way to achieve granular synthesis in real-time.
In this patch the incoming sound will be windowed. The length of the window will be set by the user or randomly chosen. To start we will make a buffer called window. A message box with the statement sizeinsamps 1024, fill 1, apply hamming, will create a hamming envelop in the buffer. Any envelope can work and the user can substitute their own. We will be using index~ to read back this buffer. Connected to index will be a line~ object with a message saying 0, 1024 $1. The 1024 is the number of samples and can be user defined. The $1 is time and can be set in a variety of different ways.
I am using tapin~ and tapout~ to add a little bit of delay to the signal, but this step is not necessary. To trigger a grain I am using a metro that is connected to a random object. Every time the random object picks a number it also uses that number to set the metro time in ms as well as the window time. The random can have any range or a controllable range however + 1 is needed to prevent 0 from occurring.
In the below example I am also panning using 2 scale objects on sqrt. The metro is also triggering a random value that controls where in space the grain is being played. This means that each grain has a different space.
In this example feedback can be added after the *~ that index~ is connected to. This will create a more complex sound by adding granulated iterations back to the signal to be granulated.