René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

grain (Csound opcode)

ar grain xamp_grain, xpitch, xdens, kampoff, kpitchoff, kgrain_dur, ifn, ifn_amp, imdur [, igrnd]
xamp_grain: the "maximal" amplitude of each grain. However, the amplitude can further be "bent" with kampoff.
xpitch: ???, see also kpitchoff
xdens: Grain density: determines how many grains per seconds are produced. (The sound is said to be synchronous granular synthesis if xdens remains constant during, and asynchronous otherwise). See also fof for synchronous granular synthesis.
kampoff: Value that determines how much the amplitude can deviate from xamp_grain.
kpitchoff: Value that determines how much the pitch (xpitch) can deviate.
kgrain_dur: Duration of a grain, to be set smaller than imdur
ifn: function table that stores the grain wave form.
ifn_amp: function table that stores the amplitude of the grain. Usually created with f20.
imdurMaximum duration of a grain
See also fog and granule
grain.orc
sr     = 44100
kr     = 4410
nchnls = 2

instr 1

  iamp = ampdb (p4)
  ifrq = cpspch(p5)

  ;kenv linseg 0, 0.02, 1000, 0.98, 0
  kenv = iamp

  asig_l grain kenv, ifrq, 10, 0, 0, 0.15, 1, 2, 1

  asig_r oscili 10000, ifrq, 1

  outs asig_l, asig_r

endin
grain.sco
#                                        1875
;f1 0 8192  7 0 1000 1 500 -1 250 1 125 -1 3158 0.1 3159 -0
f1 0 8192  10 1
f2 0 8192 20 2

i1  0  2   70   7.09

Instruments

This opcode is used for the following instruments: