arfogxamp, xdens, xtrans, xspd, koct, kband, kris, kdur, kdec, iolaps, ifna, ifnb, itotdur[, iphs[, itmode]]

Audio output is a succession of grains derived from data in a stored function table *ifna*. 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.

*iolaps* – number of pre-located spaces needed to hold overlapping grain data. Overlaps are density dependent, and the space required depends on the maximum value of *xdens** *kdur*. Can be over-estimated at no computation cost. Uses less than 50 bytes of memory per *iolaps*.

*ifna*, *ifnb* – table numbers of two stored functions. The first is the data used for granulation, usually from a soundfile (**GEN01**). The second is a rise shape, used forwards and backwards to shape the grain rise and decay; this is normally a sigmoid (**GEN19**) but may be linear (**GEN07**).

*itotdur* – total time during which this **fog** will be active. Normally set to p3. No new grain is created if it cannot complete its *kdur* within the remaining *itotdur*.

*iphs* (optional) – initial phase of the fundamental, expressed as a fraction of a cycle (0 to 1). The default value is 0.

*itmode* (optional) – transposition mode. If zero, each grain keeps the *xtrans* value it was launched with. if non-zero, each is influenced by *xtrans* continuously. The default value is 0.

*xamp* – amplitude factor. Amplitude is also dependent on the number of overlapping grains, the interaction of the rise shape (*ifnb*) and the exponential decay (*kband*), and the scaling of the grain waveform (*ifna*). The actual amplitude may therefore exceed *xamp*.

*xdens* – density. The frequency of grains per second.

*xtrans* – transposition factor. The rate at which data from the stored function table *ifna* is read within each grain. This has the effect of transposing the original material. A value of 1 produces the original pitch. Higher values transpose upwards, lower values downwards. Negative values result in the function table being read backwards.

*xspd* – speed. The rate at which successive grains advance through the stored function table *ifna*. *xspd* is in the form of an index (0 to 1) to *ifna*. This determines the movement of a pointer used as the starting point for reading data within each grain. (*xtrans* determines the rate at which data is read starting from this pointer.)

*koct* – octaviation index. The operation of this parameter is identical to that in **fof**.

*kband*, *kris*, *kdur*, *kdec* – grain envelope shape. These parameters determine the exponential decay (*kband*), and the rise (*kris*), overall duration (*kdur*,) and decay (*kdec* ) times of the grain envelope. Their operation is identical to that of the local envelope parameters in **fof**.

The Csound **fog** generator is by Michael Clarke, extending his earlier work based on IRCAM's fof algorithm.

;p4 = transposition factor ;p5 = speed factor ;p6 = function table for grain data i1 = sr/ftlen(p6) ;scaling to reflect sample rate and table length a1phasori1*p5 ;index for speed a2fog5000, 100, p4, a1, 0, 0, , .01, .02, .01, 2, p6, 1, p3, 0, 1

Michael Clark

Huddersfield

May 1997