diskgrainSignal Generators:Granular Synthesisdiskgraindiskgrain
Synchronous granular synthesis, using a soundfile as source.
Descriptiondiskgrain implements synchronous granular synthesis. The source sound for the grains is obtained by reading a soundfile containing the samples of the source waveform.
Syntaxasig diskgrain Sfname, kamp, kfreq, kpitch, kgrsize, kprate, \
ifun, iolaps [,imaxgrsize , ioffset]InitializationSfilename -- source soundfile.
ifun -- grain envelope function table.
iolaps -- maximum number of overlaps, max(kfreq)*max(kgrsize). Estimating
a large value should not affect performance, but exceeding this value will probably have disastrous
consequences.
imaxgrsize -- max grain size in secs (default 1.0).
ioffset -- start offset in secs from beginning of file (default: 0).
Performancekamp -- amplitude scaling
kfreq -- frequency of grain generation, or density, in grains/sec.
kpitch -- grain pitch scaling (1=normal pitch, < 1 lower, > 1 higher; negative, backwards)
kgrsize -- grain size in secs.
kprate -- readout pointer rate, in
grains. The value of 1 will advance the reading pointer 1 grain
ahead in the source table. Larger values will time-compress and
smaller values will time-expand the source signal. Negative
values will cause the pointer to run backwards and zero will
freeze it.
The grain generator has full control of frequency (grains/sec),
overall amplitude, grain pitch (a sampling increment) and grain
size (in secs), both as fixed or time-varying (signal)
parameters. An extra parameter is the grain pointer speed (or
rate), which controls which position the generator will start
reading samples in the file for each successive grain. It is
measured in fractions of grain size, so a value of 1 (the
default) will make each successive grain read from where the
previous grain should finish. A value of 0.5 will make the next
grain start at the midway position from the previous grain start
and finish, etc.. A value of 0 will make the generator read
always from a fixed position (wherever the pointer was last at).
A negative value will decrement pointer positions. This control
gives extra flexibility for creating timescale modifications in
the resynthesis.
Diskgrain will generate any number of
parallel grain streams (which will depend on grain
density/frequency), up to the olaps value (default 100). The
number of streams (overlapped grains) is determined by
grainsize*grain_freq. More grain overlaps will demand more
calculations and the synthesis might not run in realtime
(depending on processor power).
Diskgrain can simulate FOF-like formant
synthesis, provided that a suitable shape is used as grain
envelope and a sinewave as the grain wave. For this use, grain
sizes of around 0.04 secs can be used. The formant centre
frequency is determined by the grain pitch. Since this is a
sampling increment, in order to use a frequency in Hz, that
value has to be scaled by tablesize/sr. Grain frequency will
determine the fundamental.
This opcode is a variation on the syncgrain
opcode.
diskgrain does not do any resanmpling, so if the
sample rate of the source filename is not the same as csound's sr
value there will be pitch shifts
Examples
Here is an example of the diskgrain opcode. It uses the file diskgrain.csd.
Example of the diskgrain opcode.See the sections Real-time Audio and Command Line Flags for more information on using command line flags.See AlsoGranular SynthesisCreditsAuthor: &namevictor;May 2007
New in Csound 5.06