Files
oldboy/src/lib/csound-reference/signal-generators-granular-synthesis.ts
2025-10-15 15:05:23 +02:00

1005 lines
54 KiB
TypeScript

import type { CsoundReference } from './types'
// Signal Generators:Granular Synthesis
export const signalGeneratorsGranularSynthesis: CsoundReference[] = [
{
name: 'diskgrain',
type: 'opcode',
category: 'Signal Generators:Granular Synthesis',
description: 'Synchronous granular synthesis, using a soundfile as source.',
syntax: 'asig = diskgrain(Sfname, kamp, kfreq, kpitch, kgrsize, kprate, \\\n ifun, iolaps [,imaxgrsize , ioffset])',
example: '--8<-- "examples/diskgrain.csd"',
rates: ['a-rate', 'k-rate'],
parameters: [
{
name: 'Sfilename',
description: 'source soundfile.',
type: 'initialization'
},
{
name: 'ifun',
description: 'grain envelope function table.',
type: 'initialization'
},
{
name: 'iolaps',
description: '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.',
type: 'initialization'
},
{
name: 'imaxgrsize',
description: 'max grain size in secs (default 1.0).',
type: 'initialization'
},
{
name: 'ioffset',
description: 'start offset in secs from beginning of file (default: 0).',
type: 'initialization'
},
{
name: 'kamp',
description: 'amplitude scaling',
type: 'performance'
},
{
name: 'kfreq',
description: 'frequency of grain generation, or density, in grains/sec.',
type: 'performance'
},
{
name: 'kpitch',
description: 'grain pitch scaling (1=normal pitch, &lt; 1 lower, > 1 higher; negative, backwards)',
type: 'performance'
},
{
name: 'kgrsize',
description: 'grain size in secs.',
type: 'performance'
},
{
name: 'kprate',
description: '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.',
type: 'performance'
},
],
seeAlso: ['Granular Synthesis']
},
{
name: 'fof',
type: 'opcode',
category: 'Signal Generators:Granular Synthesis',
description: 'Produces sinusoid bursts useful for formant and granular synthesis.',
syntax: 'ares = fof(xamp, xfund, xform, koct, kband, kris, kdur, kdec, iolaps, \\\n ifna, ifnb, itotdur [, iphs] [, ifmode] [, iskip])',
example: '--8<-- "examples/fof.csd"',
rates: ['a-rate', 'i-rate'],
parameters: [
{
name: 'iolaps',
description: 'number of preallocated spaces needed to hold overlapping burst data. Overlaps are frequency dependent, and the space required depends on the maximum value of _xfund * kdur_. Can be over-estimated at no computation cost. Uses less than 50 bytes of memory per _iolap_.',
type: 'initialization'
},
{
name: 'ifna',
description: 'table numbers of two stored functions. The first is a sine table for sineburst synthesis (size of at least 4096 recommended). The second is a rise shape, used forwards and backwards to shape the sineburst rise and decay; this may be linear ([GEN07](../scoregens/gen07.md)) or perhaps a sigmoid ([GEN19](../scoregens/gen19.md)).',
type: 'initialization'
},
{
name: 'ifnb',
description: 'table numbers of two stored functions. The first is a sine table for sineburst synthesis (size of at least 4096 recommended). The second is a rise shape, used forwards and backwards to shape the sineburst rise and decay; this may be linear ([GEN07](../scoregens/gen07.md)) or perhaps a sigmoid ([GEN19](../scoregens/gen19.md)).',
type: 'initialization'
},
{
name: 'itotdur',
description: 'total time during which this _fof_ will be active. Normally set to p3. No new sineburst is created if it cannot complete its _kdur_ within the remaining _itotdur_.',
type: 'initialization'
},
{
name: 'xamp',
description: 'peak amplitude of each sineburst, observed at the true end of its rise pattern. The rise may exceed this value given a large bandwidth (say, Q &lt; 10) and/or when the bursts are overlapping.',
type: 'performance'
},
{
name: 'xfund',
description: 'the fundamental frequency (in Hertz) of the impulses that create new sinebursts.',
type: 'performance'
},
{
name: 'xform',
description: 'the formant frequency, i.e. freq of the sinusoid burst induced by each _xfund_ impulse. This frequency can be fixed for each burst or can vary continuously (see _ifmode_).',
type: 'performance'
},
{
name: 'koct',
description: 'octaviation index, normally zero. If greater than zero, lowers the effective _xfund_ frequency by attenuating odd-numbered sinebursts. Whole numbers are full octaves, fractions transitional.',
type: 'performance'
},
{
name: 'kband',
description: 'the formant bandwidth (at -6dB), expressed in Hz. The bandwidth determines the rate of exponential decay throughout the sineburst, before the enveloping described below is applied.',
type: 'performance'
},
{
name: 'kris',
description: 'rise, overall duration, and decay times (in seconds) of the sinusoid burst. These values apply an enveloped duration to each burst, in similar fashion to a Csound _linen_ generator but with rise and decay shapes derived from the _ifnb_ input. _kris_ inversely determines the skirtwidth (at -40 dB) of the induced formant region. _kdur_ affects the density of sineburst overlaps, and thus the speed of computation. Typical values for vocal imitation are .003,.02,.007.',
type: 'performance'
},
{
name: 'kdur',
description: 'rise, overall duration, and decay times (in seconds) of the sinusoid burst. These values apply an enveloped duration to each burst, in similar fashion to a Csound _linen_ generator but with rise and decay shapes derived from the _ifnb_ input. _kris_ inversely determines the skirtwidth (at -40 dB) of the induced formant region. _kdur_ affects the density of sineburst overlaps, and thus the speed of computation. Typical values for vocal imitation are .003,.02,.007.',
type: 'performance'
},
{
name: 'kdec',
description: 'rise, overall duration, and decay times (in seconds) of the sinusoid burst. These values apply an enveloped duration to each burst, in similar fashion to a Csound _linen_ generator but with rise and decay shapes derived from the _ifnb_ input. _kris_ inversely determines the skirtwidth (at -40 dB) of the induced formant region. _kdur_ affects the density of sineburst overlaps, and thus the speed of computation. Typical values for vocal imitation are .003,.02,.007.',
type: 'performance'
},
],
seeAlso: ['Granular Synthesis']
},
{
name: 'fof2',
type: 'opcode',
category: 'Signal Generators:Granular Synthesis',
description: 'Produces sinusoid bursts including k-rate incremental indexing with each successive burst.',
syntax: 'ares = fof2(xamp, xfund, xform, koct, kband, kris, kdur, kdec, iolaps, \\\n ifna, ifnb, itotdur, kphs, kgliss [, iskip])',
example: '--8<-- "examples/fof2.csd"',
rates: ['a-rate'],
parameters: [
{
name: 'iolaps',
description: 'number of preallocated spaces needed to hold overlapping burst data. Overlaps are frequency dependent, and the space required depends on the maximum value of _xfund * kdur_. Can be over-estimated at no computation cost. Uses less than 50 bytes of memory per _iolap_.',
type: 'initialization'
},
{
name: 'ifna',
description: 'table numbers of two stored functions. The first is a sine table for sineburst synthesis (size of at least 4096 recommended). The second is a rise shape, used forwards and backwards to shape the sineburst rise and decay; this may be linear ([GEN07](../scoregens/gen07.md)) or perhaps a sigmoid ([GEN19](../scoregens/gen19.md)).',
type: 'initialization'
},
{
name: 'ifnb',
description: 'table numbers of two stored functions. The first is a sine table for sineburst synthesis (size of at least 4096 recommended). The second is a rise shape, used forwards and backwards to shape the sineburst rise and decay; this may be linear ([GEN07](../scoregens/gen07.md)) or perhaps a sigmoid ([GEN19](../scoregens/gen19.md)).',
type: 'initialization'
},
{
name: 'itotdur',
description: 'total time during which this _fof_ will be active. Normally set to p3. No new sineburst is created if it cannot complete its _kdur_ within the remaining _itotdur_.',
type: 'initialization'
},
{
name: 'xamp',
description: 'peak amplitude of each sineburst, observed at the true end of its rise pattern. The rise may exceed this value given a large bandwidth (say, Q &lt; 10) and/or when the bursts are overlapping.',
type: 'performance'
},
{
name: 'xfund',
description: 'the fundamental frequency (in Hertz) of the impulses that create new sinebursts.',
type: 'performance'
},
{
name: 'xform',
description: 'the formant frequency, i.e. freq of the sinusoid burst induced by each _xfund_ impulse. This frequency can be fixed for each burst or can vary continuously.',
type: 'performance'
},
{
name: 'koct',
description: 'octaviation index, normally zero. If greater than zero, lowers the effective _xfund_ frequency by attenuating odd-numbered sinebursts. Whole numbers are full octaves, fractions transitional.',
type: 'performance'
},
{
name: 'kband',
description: 'the formant bandwidth (at -6dB), expressed in Hz. The bandwidth determines the rate of exponential decay throughout the sineburst, before the enveloping described below is applied.',
type: 'performance'
},
{
name: 'kris',
description: 'rise, overall duration, and decay times (in seconds) of the sinusoid burst. These values apply an enveloped duration to each burst, in similar fashion to a Csound _linen_ generator but with rise and decay shapes derived from the _ifnb_ input. _kris_ inversely determines the skirtwidth (at -40 dB) of the induced formant region. _kdur_ affects the density of sineburst overlaps, and thus the speed of computation. Typical values for vocal imitation are .003,.02,.007.',
type: 'performance'
},
{
name: 'kdur',
description: 'rise, overall duration, and decay times (in seconds) of the sinusoid burst. These values apply an enveloped duration to each burst, in similar fashion to a Csound _linen_ generator but with rise and decay shapes derived from the _ifnb_ input. _kris_ inversely determines the skirtwidth (at -40 dB) of the induced formant region. _kdur_ affects the density of sineburst overlaps, and thus the speed of computation. Typical values for vocal imitation are .003,.02,.007.',
type: 'performance'
},
{
name: 'kdec',
description: 'rise, overall duration, and decay times (in seconds) of the sinusoid burst. These values apply an enveloped duration to each burst, in similar fashion to a Csound _linen_ generator but with rise and decay shapes derived from the _ifnb_ input. _kris_ inversely determines the skirtwidth (at -40 dB) of the induced formant region. _kdur_ affects the density of sineburst overlaps, and thus the speed of computation. Typical values for vocal imitation are .003,.02,.007.',
type: 'performance'
},
{
name: 'kphs',
description: 'allows k-rate indexing of function table _ifna_ with each successive burst, making it suitable for time-warping applications. Values of _kphs_ are normalized from 0 to 1, 1 being the end of the function table _ifna_.',
type: 'performance'
},
{
name: 'kgliss',
description: 'sets the end pitch of each grain relative to the initial pitch, in octaves. Thus _kgliss_ = 2 means that the grain ends two octaves above its initial pitch, while _kgliss_ = -3/4 has the grain ending a major sixth below. Each 1/12 added to _kgliss_ raises the ending frequency one half-step. If you want no glissando, set _kgliss_ to 0.',
type: 'performance'
},
],
seeAlso: ['Granular Synthesis']
},
{
name: 'fog',
type: 'opcode',
category: 'Signal Generators:Granular Synthesis',
description: 'Audio output is a succession of grains derived from data in a stored function table.',
syntax: 'ares = fog(xamp, xdens, xtrans, aspd, koct, kband, kris, kdur, kdec, \\\n iolaps, ifna, ifnb, itotdur [, iphs] [, itmode] [, iskip])',
example: '--8<-- "examples/fog.csd"',
rates: ['a-rate', 'i-rate'],
parameters: [
{
name: 'iolaps',
description: '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_.',
type: 'initialization'
},
{
name: 'ifna',
description: 'table numbers of two stored functions. The first is the data used for granulation, usually from a soundfile ([GEN01](../scoregens/gen01.md)). The second is a rise shape, used forwards and backwards to shape the grain rise and decay; this is normally a sigmoid ([GEN19](../scoregens/gen19.md)) but may be linear ([GEN05](../scoregens/gen05.md)).',
type: 'initialization'
},
{
name: 'ifnb',
description: 'table numbers of two stored functions. The first is the data used for granulation, usually from a soundfile ([GEN01](../scoregens/gen01.md)). The second is a rise shape, used forwards and backwards to shape the grain rise and decay; this is normally a sigmoid ([GEN19](../scoregens/gen19.md)) but may be linear ([GEN05](../scoregens/gen05.md)).',
type: 'initialization'
},
{
name: 'itotdur',
description: '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_.',
type: 'initialization'
},
{
name: 'xamp',
description: '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_.',
type: 'performance'
},
{
name: 'xdens',
description: 'density. The frequency of grains per second.',
type: 'performance'
},
{
name: 'xtrans',
description: '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.',
type: 'performance'
},
{
name: 'aspd',
description: '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.)',
type: 'performance'
},
{
name: 'koct',
description: 'octaviation index. The operation of this parameter is identical to that in [fof](../opcodes/fof.md).',
type: 'performance'
},
{
name: 'kband',
description: '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_.',
type: 'performance'
},
{
name: 'kris',
description: '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_.',
type: 'performance'
},
{
name: 'kdur',
description: '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_.',
type: 'performance'
},
{
name: 'kdec',
description: '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_.',
type: 'performance'
},
],
seeAlso: ['Granular Synthesis']
},
{
name: 'grain',
type: 'opcode',
category: 'Signal Generators:Granular Synthesis',
description: 'Generates granular synthesis textures.',
syntax: 'ares = grain(xamp, xpitch, xdens, kampoff, kpitchoff, kgdur, igfn, \\\n iwfn, imgdur [, igrnd])',
example: '--8<-- "examples/grain.csd"',
rates: ['a-rate'],
parameters: [
{
name: 'igfn',
description: 'The ftable number of the grain waveform. This can be just a sine wave or a sampled sound.',
type: 'initialization'
},
{
name: 'iwfn',
description: 'Ftable number of the amplitude envelope used for the grains (see also [GEN20](../scoregens/gen20.md)).',
type: 'initialization'
},
{
name: 'imgdur',
description: 'Maximum grain duration in seconds. This is the biggest value to be assigned to _kgdur_.',
type: 'initialization'
},
{
name: 'xamp',
description: 'Amplitude of each grain.',
type: 'performance'
},
{
name: 'xpitch',
description: 'Grain pitch. To use the original frequency of the input sound, use the formula:',
type: 'performance'
},
{
name: 'xdens',
description: 'Density of grains measured in grains per second. If this is constant then the output is synchronous granular synthesis, very similar to [fof](../opcodes/fof.md). If _xdens_ has a random element (like added noise), then the result is more like asynchronous granular synthesis.',
type: 'performance'
},
{
name: 'kampoff',
description: 'Maximum amplitude deviation from _xamp_. This means that the maximum amplitude a grain can have is _xamp_ + _kampoff_ and the minimum is _xamp_. If _kampoff_ is set to zero then there is no random amplitude for each grain.',
type: 'performance'
},
{
name: 'kpitchoff',
description: 'Maximum pitch deviation from _xpitch_ in Hz. Similar to _kampoff_.',
type: 'performance'
},
{
name: 'kgdur',
description: 'Grain duration in seconds. The maximum value for this should be declared in _imgdur_. If _kgdur_ at any point becomes greater than _imgdur_, it will be truncated to _imgdur_.',
type: 'performance'
},
],
seeAlso: ['Granular Synthesis']
},
{
name: 'grain2',
type: 'opcode',
category: 'Signal Generators:Granular Synthesis',
description: 'Easy-to-use granular synthesis texture generator.',
syntax: 'ares = grain2(kcps, kfmd, kgdur, iovrlp, kfn, iwfn [, irpow] \\\n [, iseed] [, imode])',
example: '--8<-- "examples/grain2.csd"',
rates: ['a-rate', 'k-rate'],
parameters: [
{
name: 'iovrlp',
description: '(fixed) number of overlapping grains.',
type: 'initialization'
},
{
name: 'iwfn',
description: 'function table containing window waveform (Use [GEN20](../scoregens/gen20.md) to calculate _iwfn_).',
type: 'initialization'
},
{
name: 'ares',
description: 'output signal.',
type: 'performance'
},
{
name: 'kcps',
description: 'grain frequency in Hz.',
type: 'performance'
},
{
name: 'kfmd',
description: 'random variation (bipolar) in grain frequency in Hz.',
type: 'performance'
},
{
name: 'kgdur',
description: 'grain duration in seconds. _kgdur_ also controls the duration of already active grains (actually the speed at which the window function is read). This behavior does not depend on the _imode_ flags.',
type: 'performance'
},
{
name: 'kfn',
description: 'function table containing grain waveform. Table number can be changed at k-rate (this is useful to select from a set of band-limited tables generated by [GEN30](../scoregens/gen30.md), to avoid aliasing).',
type: 'performance'
},
],
seeAlso: ['Granular Synthesis']
},
{
name: 'grain3',
type: 'opcode',
category: 'Signal Generators:Granular Synthesis',
description: 'Generate granular synthesis textures with more user control.',
syntax: 'ares = grain3(kcps, kphs, kfmd, kpmd, kgdur, kdens, imaxovr, kfn, iwfn, \\\n kfrpow, kprpow [, iseed] [, imode])',
example: '--8<-- "examples/grain3.csd"',
rates: ['a-rate', 'k-rate'],
parameters: [
{
name: 'imaxovr',
description: 'maximum number of overlapping grains. The number of overlaps can be calculated by (_kdens_ * _kgdur_); however, it can be overestimated at no cost in rendering time, and a single overlap uses (depending on system) 16 to 32 bytes of memory.',
type: 'initialization'
},
{
name: 'iwfn',
description: 'function table containing window waveform (Use Use [GEN20](../scoregens/gen20.md) to calculate _iwfn_).',
type: 'initialization'
},
{
name: 'ares',
description: 'output signal.',
type: 'performance'
},
{
name: 'kcps',
description: 'grain frequency in Hz.',
type: 'performance'
},
{
name: 'kphs',
description: 'grain phase. This is the location in the grain waveform table, expressed as a fraction (between 0 to 1) of the table length.',
type: 'performance'
},
{
name: 'kfmd',
description: 'random variation (bipolar) in grain frequency in Hz.',
type: 'performance'
},
{
name: 'kpmd',
description: 'random variation (bipolar) in start phase.',
type: 'performance'
},
{
name: 'kgdur',
description: 'grain duration in seconds. _kgdur_ also controls the duration of already active grains (actually the speed at which the window function is read). This behavior does not depend on the _imode_ flags.',
type: 'performance'
},
{
name: 'kdens',
description: 'number of grains per second.',
type: 'performance'
},
{
name: 'kfrpow',
description: 'this value controls the distribution of grain frequency variation. If _kfrpow_ is positive, the random distribution (x is in the range -1 to 1) is:',
type: 'performance'
},
{
name: 'kprpow',
description: 'distribution of random phase variation (see _kfrpow_). Setting _kphs_ and _kpmd_ to 0.5, and _kprpow_ to 0 will emulate _grain2_.',
type: 'performance'
},
{
name: 'kfn',
description: 'function table containing grain waveform. Table number can be changed at k-rate (this is useful to select from a set of band-limited tables generated by Use [GEN30](../scoregens/gen30.md), to avoid aliasing).',
type: 'performance'
},
],
seeAlso: ['Granular Synthesis']
},
{
name: 'granule',
type: 'opcode',
category: 'Signal Generators:Granular Synthesis',
description: 'A more complex granular synthesis texture generator.',
syntax: 'ares = granule(xamp, ivoice, iratio, imode, ithd, ifn, ipshift, igskip, \\\n igskip_os, ilength, kgap, igap_os, kgsize, igsize_os, iatt, idec \\\n [, iseed] [, ipitch1] [, ipitch2] [, ipitch3] [, ipitch4] [, ifnenv])',
example: '--8<-- "examples/granule.csd"',
rates: ['a-rate', 'i-rate'],
parameters: [
{
name: 'ivoice',
description: 'number of voices.',
type: 'initialization'
},
{
name: 'iratio',
description: 'ratio of the speed of the gskip pointer relative to output audio sample rate. eg. 0.5 will be half speed.',
type: 'initialization'
},
{
name: 'imode',
description: '+1 grain pointer move forward (same direction of the gskip pointer), -1 backward (oppose direction to the gskip pointer) or 0 for random.',
type: 'initialization'
},
{
name: 'ithd',
description: 'threshold, if the sampled signal in the wavetable is smaller then _ithd_, it will be skipped.',
type: 'initialization'
},
{
name: 'ifn',
description: 'function table number of sound source.',
type: 'initialization'
},
{
name: 'ipshift',
description: 'pitch shift control. If _ipshift_ is 0, pitch will be set randomly up and down an octave. If _ipshift_ is 1, 2, 3 or 4, up to four different pitches can be set amount the number of voices defined in _ivoice_. The optional parameters _ipitch1_, _ipitch2_, _ipitch3_ and _ipitch4_ are used to quantify the pitch shifts.',
type: 'initialization'
},
{
name: 'igskip',
description: 'initial skip from the beginning of the function table in sec.',
type: 'initialization'
},
{
name: 'igskip_os',
description: 'gskip pointer random offset in sec, 0 will be no offset.',
type: 'initialization'
},
{
name: 'ilength',
description: 'length of the table to be used starting from _igskip_ in sec.',
type: 'initialization'
},
{
name: 'igap_os',
description: 'gap random offset in % of the gap size, 0 gives no offset.',
type: 'initialization'
},
{
name: 'igsize_os',
description: 'grain size random offset in % of grain size, 0 gives no offset.',
type: 'initialization'
},
{
name: 'iatt',
description: 'attack of the grain envelope in % of grain size.',
type: 'initialization'
},
{
name: 'idec',
description: 'decade of the grain envelope in % of grain size.',
type: 'initialization'
},
{
name: 'xamp',
description: 'amplitude.',
type: 'performance'
},
{
name: 'kgap',
description: 'gap between grains in sec.',
type: 'performance'
},
{
name: 'kgsize',
description: 'grain size in sec.',
type: 'performance'
},
],
seeAlso: ['Granular Synthesis']
},
{
name: 'partikkel',
type: 'opcode',
category: 'Signal Generators:Granular Synthesis',
description: '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.',
syntax: 'a1 [, a2, a3, a4, a5, a6, a7, a8] = partikkel(agrainfreq, \\\n kdistribution, idisttab, async, kenv2amt, ienv2tab, ienv_attack, \\\n ienv_decay, ksustain_amount, ka_d_ratio, kduration, kamp, igainmasks, \\\n kwavfreq, ksweepshape, iwavfreqstarttab, iwavfreqendtab, awavfm, \\\n ifmamptab, kfmenv, icosine, ktraincps, knumpartials, kchroma, \\\n ichannelmasks, krandommask, kwaveform1, kwaveform2, kwaveform3, \\\n kwaveform4, iwaveamptab, asamplepos1, asamplepos2, asamplepos3, \\\n asamplepos4, kwavekey1, kwavekey2, kwavekey3, kwavekey4, imax_grains \\\n [, iopcode_id, ipanlaws])',
example: '--8<-- "examples/partikkel.csd"',
rates: ['k-rate'],
parameters: [
{
name: 'idisttab',
description: '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).',
type: 'initialization'
},
{
name: 'ienv_attack',
description: '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).',
type: 'initialization'
},
{
name: 'ienv_decay',
description: '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).',
type: 'initialization'
},
{
name: 'ienv2tab',
description: '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).',
type: 'initialization'
},
{
name: 'icosine',
description: 'function table number, must contain a cosine, used for trainlets. Table size should be at least 2048 for good quality trainlets.',
type: 'initialization'
},
{
name: 'igainmasks',
description: '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).',
type: 'initialization'
},
{
name: 'ichannelmasks',
description: '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).',
type: 'initialization'
},
{
name: 'iwavfreqstarttab',
description: '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.',
type: 'initialization'
},
{
name: 'iwavfreqendtab',
description: '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.',
type: 'initialization'
},
{
name: 'ifmamptab',
description: '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.',
type: 'initialization'
},
{
name: 'iwaveamptab',
description: '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.',
type: 'initialization'
},
{
name: 'imax_grains',
description: '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.',
type: 'initialization'
},
{
name: 'iopcode_id',
description: 'the opcode id, linking an instance of _partikkel_ to an instance of [partikkelsync](../opcodes/partikkelsync.md), 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.',
type: 'initialization'
},
{
name: 'ipanlaws',
description: '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.',
type: 'initialization'
},
{
name: 'xgrainfreq',
description: 'number of grains per second. A value of zero is allowed, and this will defer all grain scheduling to the sync input.',
type: 'performance'
},
{
name: 'async',
description: '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.',
type: 'performance'
},
{
name: 'kdistribution',
description: '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.',
type: 'performance'
},
{
name: 'kenv2amt',
description: '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_.',
type: 'performance'
},
{
name: 'ksustain_amount',
description: '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.',
type: 'performance'
},
{
name: 'ka_d_ratio',
description: '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.',
type: 'performance'
},
{
name: 'kduration',
description: 'grain duration in milliseconds.',
type: 'performance'
},
{
name: 'kamp',
description: '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.',
type: 'performance'
},
{
name: 'kwavfreq',
description: 'transposition scaling. Multiplied with start and end transposition values read from _iwavfreqstarttab_ and _iwavfreqendtab_.',
type: 'performance'
},
{
name: 'ksweepshape',
description: '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.',
type: 'performance'
},
{
name: 'awavfm',
description: 'audio input for frequency modulation inside grain.',
type: 'performance'
},
{
name: 'kfmenv',
description: 'function table number, envelope for FM modulator signal enabling the modulation index to change over the duration of a grain.',
type: 'performance'
},
{
name: 'ktraincps',
description: 'trainlet fundamental frequency.',
type: 'performance'
},
{
name: 'knumpartials',
description: 'number of partials in trainlets.',
type: 'performance'
},
{
name: 'kchroma',
description: '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.',
type: 'performance'
},
{
name: 'krandommask',
description: '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.',
type: 'performance'
},
{
name: 'kwaveform1',
description: 'table number for source waveform 1.',
type: 'performance'
},
{
name: 'kwaveform2',
description: 'table number for source waveform 2.',
type: 'performance'
},
{
name: 'kwaveform3',
description: 'table number for source waveform 3.',
type: 'performance'
},
{
name: 'kwaveform4',
description: 'table number for source waveform 4.',
type: 'performance'
},
{
name: 'asamplepos1',
description: 'start position for reading source waveform 1 (in range 0..1).',
type: 'performance'
},
{
name: 'asamplepos2',
description: 'start position for reading source waveform 2.',
type: 'performance'
},
{
name: 'asamplepos3',
description: 'start position for reading source waveform 3.',
type: 'performance'
},
{
name: 'asamplepos4',
description: 'start position for reading source waveform 4.',
type: 'performance'
},
{
name: 'kwavekey1',
description: 'original key of source waveform 1. Can be used to transpose each source waveform independently.',
type: 'performance'
},
{
name: 'kwavekey2',
description: 'as _kwavekey1_, but for source waveform 2.',
type: 'performance'
},
{
name: 'kwavekey3',
description: 'as _kwavekey1_, but for source waveform 3.',
type: 'performance'
},
{
name: 'kwavekey4',
description: 'as _kwavekey1_, but for source waveform 4.',
type: 'performance'
},
],
seeAlso: ['Granular Synthesis']
},
{
name: 'partikkelget',
type: 'opcode',
category: 'Signal Generators:Granular Synthesis',
description: 'Get mask index for a specific mask parameter of a running _partikkel_ instance.',
syntax: 'kindex = partikkelget(kparameterindex, iopcode_id)',
example: '--8<-- "examples/partikkelgetset.csd"',
parameters: [
{
name: 'iopcode_id',
description: 'the opcode id, linking an instance of [partikkel](../opcodes/partikkel.md) to an instance of _partikkelsync_.',
type: 'initialization'
},
{
name: 'kmaskindex',
description: 'mask index output. Outputs the current mask index for the parameter specified with _kparameterindex_ in the partikkel instance identified with _iopcode_id_.',
type: 'performance'
},
{
name: 'kparameterindex',
description: 'mask parameter. Selection of the masking parameter for which to output the current mask index. The different parameters are identified as:',
type: 'performance'
},
],
seeAlso: ['partikkel']
},
{
name: 'partikkelset',
type: 'opcode',
category: 'Signal Generators:Granular Synthesis',
description: 'Set mask index for a specific mask parameter of a running _partikkel_ instance.',
syntax: 'partikkelset(kparameterindex, kmaskindex, iopcode_id)',
example: '--8<-- "examples/partikkelgetset.csd"',
parameters: [
{
name: 'iopcode_id',
description: 'the opcode id, linking an instance of [partikkel](../opcodes/partikkel.md) to an instance of _partikkelsync_.',
type: 'initialization'
},
{
name: 'kparameterindex',
description: 'mask parameter. Selection of the masking parameter for which to set the current mask index. The different parameters are identified as:',
type: 'performance'
},
{
name: 'kmaskindex',
description: 'value to set mask index to. Sets the current mask index for the parameter specified with _kparameterindex_ in the partikkel instance identified with _iopcode_id_.',
type: 'performance'
},
],
seeAlso: ['partikkel']
},
{
name: 'partikkelsync',
type: 'opcode',
category: 'Signal Generators:Granular Synthesis',
description: 'Outputs _partikkel_\'s grain scheduler clock pulse and phase to synchronize several instances of the _partikkel_ opcode to the same clock source.',
syntax: 'async [,aphase] = partikkelsync(iopcode_id)',
example: '--8<-- "examples/partikkelsync.csd"',
parameters: [
{
name: 'iopcode_id',
description: 'the opcode id, linking an instance of [partikkel](../opcodes/partikkel.md) to an instance of _partikkelsync_.',
type: 'initialization'
},
{
name: 'async',
description: 'trigger pulse signal. Outputs trigger pulses synchronized to a _partikkel_ opcode\'s grain scheduler clock. One trigger pulse is generated for each grain started in the _partikkel_ opcode with the same _opcode_id_. The normal usage would be to send this signal to another _partikkel_ opcode\'s _async_ input to synchronize several instances of _partikkel_.',
type: 'performance'
},
{
name: 'aphase',
description: 'clock phase. Outputs a linear ramping phase signal. Can be used e.g. for softsynchronization, or just as a phase generator ala _phasor_.',
type: 'performance'
},
],
seeAlso: ['Granular Synthesis']
},
{
name: 'sndwarp',
type: 'opcode',
category: 'Signal Generators:Granular Synthesis',
description: 'Reads a mono sound sample from a table and applies time-stretching and/or pitch modification.',
syntax: 'ares [, ac] = sndwarp(xamp, xtimewarp, xresample, ifn1, ibeg, iwsize, \\\n irandw, ioverlap, ifn2, itimemode)',
example: '--8<-- "examples/sndwarp.csd"',
rates: ['a-rate'],
parameters: [
{
name: 'ifn1',
description: 'the number of the table holding the sound samples which will be subjected to the _sndwarp_ processing. [GEN01](../scoregens/gen01.md) is the appropriate function generator to use to store the sound samples from a pre-existing soundfile.',
type: 'initialization'
},
{
name: 'ibeg',
description: 'the time in seconds to begin reading in the table (or soundfile). When _itimemode_ is non- zero, the value of _xtimewarp_ is offset by _ibeg_.',
type: 'initialization'
},
{
name: 'iwsize',
description: 'the window size in samples used in the time scaling algorithm.',
type: 'initialization'
},
{
name: 'irandw',
description: 'the bandwidth of a random number generator. The random numbers will be added to _iwsize_.',
type: 'initialization'
},
{
name: 'ioverlap',
description: 'determines the density of overlapping windows.',
type: 'initialization'
},
{
name: 'ifn2',
description: 'a function used to shape the window. It is usually used to create a ramp of some kind from zero at the beginning and back down to zero at the end of each window. Try using a half sine (i.e.: f1 0 16384 9 .5 1 0) which works quite well. Other shapes can also be used.',
type: 'initialization'
},
{
name: 'ares',
description: 'the single channel of output from the _sndwarp_ unit generator. _sndwarp_ assumes that the function table holding the sampled signal is a mono one. This simply means that _sndwarp_ will index the table by single-sample frame increments. The user must be aware then that if a stereo signal is used with _sndwarp_, time and pitch will be altered accordingly.',
type: 'performance'
},
{
name: 'xamp',
description: 'the value by which to scale the amplitude (see note on the use of this when using _ac_).',
type: 'performance'
},
{
name: 'xtimewarp',
description: 'determines how the input signal will be stretched or shrunk in time. There are two ways to use this argument depending upon the value given for _itimemode_. When the value of _itimemode_ is 0, _xtimewarp_ will scale the time of the sound. For example, a value of 2 will stretch the sound by 2 times. When _itimemode_ is any non-zero value then _xtimewarp_ is used as a time pointer in a similar way in which the time pointer works in [lpread](../opcodes/lpread.md) and [pvoc](../opcodes/pvoc.md). An example below illustrates this. In both cases, the pitch will _not_ be altered by this process. Pitch shifting is done independently using _xresample_.',
type: 'performance'
},
{
name: 'xresample',
description: 'the factor by which to change the pitch of the sound. For example, a value of 2 will produce a sound one octave higher than the original. The timing of the sound, however, will _not_ be altered.',
type: 'performance'
},
],
seeAlso: ['Granular Synthesis']
},
{
name: 'sndwarpst',
type: 'opcode',
category: 'Signal Generators:Granular Synthesis',
description: 'Reads a stereo sound sample from a table and applies time-stretching and/or pitch modification.',
syntax: 'ar1, ar2 [,ac1] [, ac2] = sndwarpst(xamp, xtimewarp, xresample, ifn1, \\\n ibeg, iwsize, irandw, ioverlap, ifn2, itimemode)',
example: '--8<-- "examples/sndwarpst.csd"',
parameters: [
{
name: 'ifn1',
description: 'the number of the table holding the sound samples which will be subjected to the _sndwarpst_ processing. [GEN01](../scoregens/gen01.md) is the appropriate function generator to use to store the sound samples from a pre-existing soundfile.',
type: 'initialization'
},
{
name: 'ibeg',
description: 'the time in seconds to begin reading in the table (or soundfile). When _itimemode_ is non-zero, the value of _xtimewarp_ is offset by _ibeg_.',
type: 'initialization'
},
{
name: 'iwsize',
description: 'the window size in samples used in the time scaling algorithm.',
type: 'initialization'
},
{
name: 'irandw',
description: 'the bandwidth of a random number generator. The random numbers will be added to _iwsize_.',
type: 'initialization'
},
{
name: 'ioverlap',
description: 'determines the density of overlapping windows.',
type: 'initialization'
},
{
name: 'ifn2',
description: 'a function used to shape the window. It is usually used to create a ramp of some kind from zero at the beginning and back down to zero at the end of each window. Try using a half a sine (i.e.: f1 0 16384 9 .5 1 0) which works quite well. Other shapes can also be used.',
type: 'initialization'
},
{
name: 'ar1',
description: '_ar1_ and _ar2_ are the stereo (left and right) outputs from _sndwarpst_. _sndwarpst_ assumes that the function table holding the sampled signal is a stereo one. _sndwarpst_ will index the table by a two-sample frame increment. The user must be aware then that if a mono signal is used with _sndwarpst_, time and pitch will be altered accordingly.',
type: 'performance'
},
{
name: 'ar2',
description: '_ar1_ and _ar2_ are the stereo (left and right) outputs from _sndwarpst_. _sndwarpst_ assumes that the function table holding the sampled signal is a stereo one. _sndwarpst_ will index the table by a two-sample frame increment. The user must be aware then that if a mono signal is used with _sndwarpst_, time and pitch will be altered accordingly.',
type: 'performance'
},
{
name: 'ac1',
description: '_ac1_ and _ac2_ are single-layer (no overlaps), unwindowed versions of the time and/or pitch altered signal. They are supplied in order to be able to balance the amplitude of the signal output, which typically contains many overlapping and windowed versions of the signal, with a clean version of the time-scaled and pitch-shifted signal. The _sndwarpst_ process can cause noticeable changes in amplitude, (up and down), due to a time differential between the overlaps when time-shifting is being done. When used with a [balance](../opcodes/balance.md) unit, _ac1_ and _ac2_ can greatly enhance the quality of sound. They are optional, but note that they must both be present in the syntax (use both or neither). An example of how to use this is given below.',
type: 'performance'
},
{
name: 'ac2',
description: '_ac1_ and _ac2_ are single-layer (no overlaps), unwindowed versions of the time and/or pitch altered signal. They are supplied in order to be able to balance the amplitude of the signal output, which typically contains many overlapping and windowed versions of the signal, with a clean version of the time-scaled and pitch-shifted signal. The _sndwarpst_ process can cause noticeable changes in amplitude, (up and down), due to a time differential between the overlaps when time-shifting is being done. When used with a [balance](../opcodes/balance.md) unit, _ac1_ and _ac2_ can greatly enhance the quality of sound. They are optional, but note that they must both be present in the syntax (use both or neither). An example of how to use this is given below.',
type: 'performance'
},
{
name: 'xamp',
description: 'the value by which to scale the amplitude (see note on the use of this when using _ac1_ and _ac2_).',
type: 'performance'
},
{
name: 'xtimewarp',
description: 'determines how the input signal will be stretched or shrunk in time. There are two ways to use this argument depending upon the value given for _itimemode_. When the value of _itimemode_ is 0, _xtimewarp_ will scale the time of the sound. For example, a value of 2 will stretch the sound by 2 times. When _itimemode_ is any non-zero value then _xtimewarp_ is used as a time pointer in a similar way in which the time pointer works in [lpread](../opcodes/lpread.md) and [pvoc](../opcodes/pvoc.md). An example below illustrates this. In both cases, the pitch will _not_ be altered by this process. Pitch shifting is done independently using _xresample_.',
type: 'performance'
},
{
name: 'xresample',
description: 'the factor by which to change the pitch of the sound. For example, a value of 2 will produce a sound one octave higher than the original. The timing of the sound, however, will _not_ be altered.',
type: 'performance'
},
],
seeAlso: ['Granular Synthesis']
},
]