Granular synthesis opcodes in Csound

Just to give an idea of the depth, of Csound: there is not just one, but numerous opcodes in Csound that do various types of granular synthesis. Just to sort of bring them all together for comparison, a summary follows. These are all excerpted from the HTML Csound manual, and examples are given for each one.

To look at the manual online (in case you haven’t installed Csound on the computer you’re currently reading this on) see (frames version)

  • grain — Basic unit generator to create granular synthesis textures

  • granule — A more complex (compared to grain) granular synthesis texture generator.

The granule unit generator is more complex than grain, but does add new possibilities. The characteristics of the synthesis are controlled by 22 parameters.

granule employs a wavetable as input to produce granularly synthesized audio output. Wavetable data may be generated by any of the GEN subroutines which reads an audio data file into a wavetable. This enable a sampled sound to be used as the source for the grains. Up to 128 voices are implemented internally.

granule has a build-in random number generator to handle all the random offset parameters. Thresholding is also implemented to scan the source function table at initialization stage. This facilitates features such as skipping silence between sentences.

  • fof — Produces output as a succession of grains derived from data in a stored function table.

The local envelope of these grains and their timing is based on the model of fof synthesis and permits detailed control of the granular synthesis.

  • fof2 — Produces sinusoid bursts including k-rate incremental indexing with each successive burst.

  • grain3 — Generate granular synthesis textures with more user control

  • partikkel — Granular synthesizer with “per grain” control over many of its parameters. Has a sync input to synchronize its internal grain scheduler clock to an external clock source (see the partikkelsync opcode.)

partikkel was conceived after reading Curtis Roads’ book “Microsound”, and the goal was to create an opcode that was capable of all time-domain varieties of granular synthesis described in this book. The idea being that most of the techniques only differ in parameter values, and by having a single opcode that can do all varieties of granular synthesis makes it possible to interpolate between techniques. Granular synthesis is sometimes dubbed particle synthesis, and it was thought apt to name the opcode partikkel to distinguish it from other granular opcodes.

According to a posting on the Csound mailing list at, the version of partikkel in Csound 5.06 is the wrong one. The rumor is that this will be fixed in the next released, due around 1 October 2007.

  • syncgrain — Synchronous granular synthesis.

The source sound for the grains is obtained by reading a function table containing the samples of the source waveform. For sampled-sound sources, GEN01 is used. Syncgrain will accept deferred allocation tables

  • diskgrain — Synchronous granular synthesis, using a soundfile as source.

There are also opcodes which use granular synthesis techniques but are intended only as (e.g.) pitch modifiers. For instance, sndwarp (mono) and sndwarpst (stereo) read a sound sample from a table and applies time-stretching and/or pitch modification

 One thing I want to experiment with is how expensive these opcodes are CPU wise. Early experiments seems to indicate that some of the old ones are very expensive, and can be pretty much duplicated by more recent ones. I believe the manual usually gives a reference as to which version of Csound an opcode was introduced in, to give you a sense of what “old” and “recent” might be.

Within the past year or two (2009 – 2011?), a bunch of stalwart Csounders started a FLOSS project to document Csound is a more usable and modern way. At first I wondered why FLOSS instead of a wiki, but the results I’m seeing look pretty impressive. Take a look at the granular synthesis section at

and of course, as with a wiki, community involvement is what’s making it go.

Last modified 2011-04-22 / tps


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: