fog
Prev | Orchestra Opcodes and Operators | Next

## fog

fog — Audio output is a succession of grains derived from data in a stored function table

## Description

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.

## Syntax

    ares fog xamp, xdens, xtrans, aspd, koct, kband, kris, kdur, kdec, \
          iolaps, ifna, ifnb, itotdur [, iphs] [, itmode] [, iskip]

## Initialization

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 iolap.

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 (GEN05).

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.

iskip (optional, default=0) -- If non-zero, skip initialization (allows legato use).

## Performance

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.

aspd -- Starting index pointer. aspd is the normalized index (0 to 1) to table ifna that 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.

## Examples

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

## Credits

Author: Michael Clark
Huddersfield
May 1997

New in version 3.46

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

Added notes by Rasmus Ekman on September 2002.

Prev | Up | Next
fofilter | Home | fold