With regard to sampling (3.3) you learned how to change the speed of an existing sound in an array, but this also resulted in a change of pitch. One way to decouple these parameters, is by using granular synthesis. The idea of granular synthesis is that a sound is sampled at the original speed, but it is played at a different speed from each sample point.
You have an "indicator" that moves across the array at normal speed:
patches/3-7-1-1-granular-theory1.pd
Only at certain intervals do we get information about the indicator's present position; when this information is received, the array is played back from that point, albeit at a different speed.
To understand this better, let's say this is the normal playback speed:
...and this is a speed that is 'too fast':
...then granular synthesis does this:
Though playback is 'too fast' (or 'too slow'), it always begins at a point that corresponds to the initial speed. These individual chunks are called "grains"; their size is referred to either as "grain size" or "window size". These "grains" are so tiny and used in such large quantities, that they are not heard individually, but rather as a continuous whole. That's the magic behind granular synthesis.
Every individual "grain" is played back like this:
After a grain is played, there is a jump to the next position; this position is taken from the current position of the "main indicator". There is a special object to accomplish this: "samphold~". It works like "spigot", only on the signal level. Both the left and right inlets receive a signal. When there is descending step in the right inlet, "samphold~" immediately sends the sample currently in the left inlet and repeats this until the value in the right inlet is lower than the preceding one. This somewhat strange setting makes sense if the right input is a "phasor~". It receives only once - right at the end of a period - a descending step. A grain could be read out this way and the offset could be added to the end of it:
patches/3-7-1-1-granular-theory2.pd
This way, the whole thing sounds higher, but with the same duration as the original. If you 'look' closely, it's clear that this could lead to complications. If playback from one sample to the next is faster than the indicator's speed (which runs at the original speed), then we'll overshoot a sample and then return to it (thus repeating it) the next time "samphold~" is triggered. Conversely, if the "grains" are played back more slowly than the indicator moves, then some parts will be omitted. But as long as the original and the playback speeds do not diverge too dramatically, this is not (terribly) noticeable. To rectify this, some improvements can be made. First, you could use a Hanning window to suppress the clicks that result with every jump to a new value:
patches/3-7-1-1-granular-theory3.pd
The resultant gaps can be filled by using a second grain-reader, shifted by half a period:
patches/3-7-1-1-granular-theory4.pd
The nice thing about granular synthesis is that, in addition to the ability to change pitch without affecting speed, you can change speed without affecting pitch:
patches/3-7-1-1-granular-theory5.pd
For use in live performance, you'll again need to use variable delays:
patches/3-7-2-1-granular-live.pd
Granular synthesis can also be used as a synthesizer for pitch clouds, most conveniently using a random generator:
patches/3-7-3-1-granularsynthesizer.pd