partikkelSignal Generators:Granular Synthesispartikkelpartikkel
Granular synthesizer with "per grain" control
over many of its parameters. Has a sync input to
sychronize its internal grain scheduler clock to an external
clock source.
Descriptionpartikkel 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.
Some of the input parameters to partikkel is table numbers,
pointing to tables where values for the "per grain" parameter
changes are stored. partikkel can use single-cycle or complex
(e.g. sampled sound) waveforms as source waveforms for
grains. Each grain consists of a mix of 4 source
waveforms. Individual tuning of the base frequency can be done
for each of the 4 source waveforms. Frequency modulation inside
each grain is enabled via an auxillary audio input
(awavfm). Trainlet synthesis is available, and trainlets can be
mixed with wavetable based grains. Up to 8 separate audio
outputs can be used. Fractional output values will distribute a grain between two outputs
and a "panning law" table can be devised to control the amplitude scaling between output pairs.
Syntaxa1 [, a2, a3, a4, a5, a6, a7, a8] partikkel agrainfreq, \
kdistribution, idisttab, async, kenv2amt, ienv2tab, ienv_attack, \
ienv_decay, ksustain_amount, ka_d_ratio, kduration, kamp, igainmasks, \
kwavfreq, ksweepshape, iwavfreqstarttab, iwavfreqendtab, awavfm, \
ifmamptab, kfmenv, icosine, ktraincps, knumpartials, kchroma, \
ichannelmasks, krandommask, kwaveform1, kwaveform2, kwaveform3, \
kwaveform4, iwaveamptab, asamplepos1, asamplepos2, asamplepos3, \
asamplepos4, kwavekey1, kwavekey2, kwavekey3, kwavekey4, imax_grains \
[, iopcode_id, ipanlaws]Initializationidisttab -- function table number,
distribution for random grain displacements over time. The table
values are interpreted as "displacement amount" scaled by
1/grainrate. This means that a value of 0.5 in the table will
displace a grain by half the grainrate period. The table values
are read randomly, and scaled by kdistribution. For realistic
stochastic results, it is advisable not to use a too small table
size, as this limits the amount of possible displacement
values. This can also be utilized for other purposes, e.g. using
quantized displacement values to work with controlled time
displacement from the periodic grain rate. If kdistribution is
negative, the table values will be read sequentially. A default
table might be selected by using -1 as the ftable number, for
idisttab the default uses a zero distribution (no
displacement).
ienv_attack -- function table number,
attack shape of grain. Needs extended guard point. A default
table might be selected by using -1 as the ftable number, for
ienv_attack the default uses a square window (no enveloping).
ienv_decay -- function table number, decay
shape of grain. Needs extended guard point. A default table
might be selected by using -1 as the ftable number, for
ienv_decay the default uses a square window (no enveloping).
ienv2tab -- function table number,
additional envelope applied to grain, done after attack and
decay envelopes. Can be used e.g. for fof formant
synthesis. Needs extended guard point. A default table might be
selected by using -1 as the ftable number, for ienv2tab the
default uses a square window (no enveloping).
icosine -- function table number, must
contain a cosine, used for trainlets. Table size should be at least 2048 for good quality trainlets.
igainmasks -- function table number, gain per
grain. The sequence of values in the table is as follows: index
0 is used as a loop start point in reading the values, index 1
is used as a loop end point. Remaining indices contain gain
values (normally in range 0 - 1, but other values are
allowed, negative values will invert phase of waveform inside
grain) for a sequence of grains, these are read at grain rate
enabling exact patterns of "gain per grain". The loop start and
end points are zero based with an origin at index 2, e.g. a loop
start value of 0 and loop end value of 3 will read indices
2,3,4,5 in a loop at grain rate. A default table might be
selected by using -1 as the ftable number, for igainmasks the
default disables gain masking (all grains are given a gain
masking value of 1).
ichannelmasks -- function table number, see igainmasks
for a description of how the values in the table are read. Range
is 0 to N, where N is the number of output channels. A
value of zero will send the grain to audio output 1 from the
opcode. Fractional values are allowed, e.g. a value of 3.5 will
mix the grain equally to outputs 4 and 5. The channelmask value wraps
around from the last to the first output, so that a vaalue of N-0.5 will
mix the grain equally between the last and the first output. If another panning law
between outputs is desired, this can be described in the ipanlaws
table. The user is responsible for keeping the values in range,
the opcode will crash with out of range values. A
default table might be selected by using -1 as the ftable
number, for ichannelmasks the default disables channel masking
(all grains are given a channel masking value of 0 and are sent
to partikkel audio out 1).
iwavfreqstarttab -- function table number,
see igainmasks for a description of how the values in the table
are read. Start frequency multiplicator for each grain. Pitch
will glide from start frequency to end frequency following a
line or curve as set by ksweepshape. A default table might be
selected by using -1 as the ftable number, for iwavfreqstarttab
the default uses a multiplicator of 1, disabling any start
frequency modification.
iwavfreqendtab -- function table number,
see iwavfreqstarttab. End frequency multiplicator for each
grain. A default table might be selected by using -1 as the
ftable number, for iwavfreqendtab the default uses a
multiplicator of 1, disabling any end frequency modification.
ifmamptab -- function table number,
see igainmasks for a description of how
the values in the table are read. Frequency modulation index per
grain. The signal awavfm will be multiplied by values read from
this table. A default table might be selected by using -1 as the
ftable number, for ifmamptab the default uses 1 as the index
multiplicator, enabling fm for all grains.
iwaveamptab -- function table number, the
indices are read in a similar way to what is used for
igainmasks. Index 0 is used as a loop start point, and index 1
is used as a loop end point. The rest of the indices are read in
groups of 5, where each value represent a gain value for each of
the 4 source waveforms, and the 5th value represent trainlet
amplitude. A default table might be selected by
using -1 as the ftable number, for iwaveamptab the default uses
an equal mix of all 4 source waveforms (each with an amplitude of 0.5) and setting trainlet amp
to zero.
Computation of trainlets can be CPU intensive, and setting
ktrainamp to zero will skip most of the trainlet
computations. Trainlets will be normalized to peak (ktrainamp),
compensating for amplitude variations caused by variations in
kpartials and kchroma.
imax_grains -- maximum number of grains per k-period. Estimating a large value should not affect performance, exceeding this value will lead to "oldest grains" being deleted.
iopcode_id -- the opcode id, linking an
instance of partikkel to an instance of partikkelsync, the linked partikkelsync will output trigger pulses synchronized to partikkel's grain maker scheduler.
The default value is zero, which means no connection to any partikkelsync instances.
ipanlaws -- function table number. The table describes the panning curve used for fractional channelmask values.
Fractional channelmask values will mix a grain to two neighbouring outputs, with the relative gain set by the fractional value.
By default (if no ipanlaws table is described, a linear gain relationship is used, so that a channelmask value of e.g. 1.5 distributes
the grain with 0.5 gain to output 2 and 0.5 gain to output 3. The ipanlaws table can be used to describe other gain control curves (panning laws).
The table should contain 8 such gain control curves, each governing the panning between two neighbouring outputs.
The curves should appear one after another in the table, in a concatenated fashion. GEN 18 can be used to create this table from separate panning curve tables (see example below).
The first curve describes the panning law between output 1 and output 2, the next is for panning between outputs 2 and 3, and so on.
The last curve describes the panning law between the last and the first output. The table is indexed by the channelmask value such that one output
(of an output pair goverened by the panning law) uses the index (tablesize/8*channelmask) while the other of the two outputs reads the value at index
(tablesize/8*(int(channelmask+1)-frac(channelmask))). This means that if the panning law value halfway between these two channel masks is e.g. 0.7
(which would give approximately equal power panning), then each of those two outputs will use 0.7 as the gain value.
Performancexgrainfreq -- number of grains per
second. A value of zero is allowed, and this will defer all
grain scheduling to the sync input.
async -- sync input. Input values are added to the
phase value of the internal grain maker clock, enabling tempo synchronization
with an external clock source. As this is an a-rate signal, inputs are usually pulses
of length 1/sr. Using such pulses, the internal phase value can be "nudged" up or down,
enabling soft or hard synchronization. Negative input values decrements the internal phase,
while positive values in the range 0 to 1 increments the internal phase. An input value of 1
will always make partikkel generate a grain.
If the value remains at 1, the internal grain scheduler clock will pause but any currently
playing grains will still play to end.
kdistribution -- periodic or stochastic
distribution of grains, 0 = periodic. Stochastic grain displacement is in the range of kdistribution/grainrate seconds.
The stochastic distribution profile (random distribution) can be set in the idisttab table.
If kdistribution is negative, the result is deterministic time displacement as described by idisttab (sequential read of displacement values).
Maximum grain displacement in all cases is limited to 10 seconds,
and a grain will keep the values (duration, pitch etc) it was given when it was first generated (before time displacement).
Since grain displacement is relative to the grain rate, displacement amount is undefined at 0Hz grain rate and kdistribution is completely disabled in this case.
kenv2amt -- amount of enveloping for the
secondary envelope for each grain. Range 0 to 1, where 0 is no
secondary enveloping (square window), a value of 0.5 will use an
interpolation between a square window and the shape set by
ienv2tab.
ksustain_amount -- sustain time as fraction
of grain duration. I.e. balance between enveloped
time(attack+decay) and sustain level time. The sustain level is
taken from the last value of the ienv_attack ftable.
ka_d_ratio -- balance between attack time
and decay time. For example, with ksustain_amount set to 0.5 and
ka_d_ratio set to 0.5, the attack envelope of each grain will take 25% of
the grain duration, full amplitude (sustain) will be held for
50% of the grain duration, and the decay envelope will take the
remaining 25% of the grain duration.
kduration -- grain duration in milliseconds.
kamp -- amplitude scaling of the opcode's
output. Multiplied by per grain amplitude read from igainmasks.
Source waveform playback inside grains can consume a significant amount of CPU cycles,
especially if grain duration is long so that we have a lot of overlapping grains.
Setting kamp to zero will skip waveform playback inside grains (and not generate any sound, obviously).
This can be used as a "soft" bypass method if we want to keep the opcode active but silent for some periods of time.
kwavfreq -- transposition
scaling. Multiplied with start and end transposition values read
from iwavfreqstarttab and iwavfreqendtab.
ksweepshape -- transposition sweep shape,
controls the curvature of the transposition sweep. Range 0
to 1. Low values will hold the transposition at the start value
longer and then drop to the end value quickly, high values will
drop to the end value quickly. A value of 0.5 will give a
linear sweep. A value of exactly 0 will bypass sweep and only
use the start frequency, while a value of exactly 1 will bypass sweep
and only use the end frequency. The sweep generator might be slightly
inaccurate in hitting the end frequency when using a steep curve and very long grains.
awavfm -- audio input for frequency
modulation inside grain.
kfmenv -- function table number, envelope
for FM modulator signal enabling the modulation index to change
over the duration of a grain.
ktraincps -- trainlet fundamental frequency.
knumpartials -- number of partials in trainlets.
kchroma -- chroma of trainlets. A value of
1 give equal amplitude to each partial, higher values will
reduce the amplitude of lower partials while strengthening the
amplitude of the higher partials.
krandommask -- random masking (muting) of
individual grains. Range 0 to 1, where a value of 0 will give no
masking (all grains are played), and a value of 1 will mute all
grains.
kwaveform1 -- table number for source waveform 1.
kwaveform2 -- table number for source waveform 2.
kwaveform3 -- table number for source waveform 3.
kwaveform4 -- table number for source waveform 4.
asamplepos1 -- start position for reading
source waveform 1 (in range 0..1).
asamplepos2 -- start position for reading
source waveform 2.
asamplepos3 -- start position for reading
source waveform 3.
asamplepos4 -- start position for reading
source waveform 4.
kwavekey1 -- original key of source
waveform 1. Can be used to transpose each source waveform
independently.
kwavekey2 -- as kwavekey1, but for source
waveform 2.
kwavekey3 -- as kwavekey1, but for source
waveform 3.
kwavekey4 -- as kwavekey1, but for source waveform 4.
Examples
Here is an example of the partikkel opcode. It uses the file partikkel.csd.
Example of the partikkel opcode.See the sections Real-time Audio and Command Line Flags for more information on using command line flags.
Here is another example of the partikkel opcode. It uses the file partikkel-2.csd.
Example 2 of the partikkel opcode.
Here is an example of using panning laws with channelmasks in partikkel. It uses the file partikkel-panlaws.csd.
Example with panning laws with channel masks.See AlsoGranular SynthesisCreditsAuthor: Thom JohansenAuthor: Torgeir Strand HenriksenAuthor: &nameoeyvind;April 2007Examples written by Joachim Heintz and &nameoeyvind;.New in version 5.06