Files
oldboy/src/lib/csound-reference/signal-modifiers-convolution-and-morphing.ts
2025-10-15 15:05:23 +02:00

212 lines
8.2 KiB
TypeScript

import type { CsoundReference } from './types'
// Signal Modifiers:Convolution and Morphing
export const signalModifiersConvolutionAndMorphing: CsoundReference[] = [
{
name: 'convle',
type: 'opcode',
category: 'Signal Modifiers:Convolution and Morphing',
description: 'Same as the [convolve](../opcodes/convolve.md) opcode.',
},
{
name: 'convolve',
type: 'opcode',
category: 'Signal Modifiers:Convolution and Morphing',
description: 'Convolves a signal and an impulse response.',
syntax: 'ar1 [, ar2] [, ar3] [, ar4] = convolve(ain, ifilcod [, ichannel])',
example: 'csound -Ucvanal l1_44.wav l1_44.cv',
parameters: [
{
name: 'ifilcod',
description: 'integer or character-string denoting an impulse response data file. An integer denotes the suffix of a file _convolve.m_; a character string (in double quotes) gives a filename, optionally a full pathname. If not a fullpath, the file is sought first in the current directory, then in the one given by the environment variable SADIR (if defined). The data file contains the Fourier transform of an impulse response. Memory usage depends on the size of the data file, which is read and held entirely in memory during computation, but which is shared by multiple calls.',
type: 'initialization'
},
{
name: 'ain',
description: 'input audio signal.',
type: 'performance'
},
],
seeAlso: ['Convolution and Morphing']
},
{
name: 'cross2',
type: 'opcode',
category: 'Signal Modifiers:Convolution and Morphing',
description: 'Cross synthesis using FFT\'s.',
syntax: 'ares = cross2(ain1, ain2, isize, ioverlap, iwin, kbias)',
example: '--8<-- "examples/cross2.csd"',
rates: ['a-rate'],
parameters: [
{
name: 'isize',
description: 'This is the size of the FFT to be performed. The larger the size the better the frequency response but a sloppy time response.',
type: 'initialization'
},
{
name: 'ioverlap',
description: 'This is the overlap factor of the FFT\'s, must be a power of two. The best settings are 2 and 4. A big overlap takes a long time to compile.',
type: 'initialization'
},
{
name: 'iwin',
description: 'This is the function table that contains the window to be used in the analysis. One can use the [GEN20](../scoregens/gen20.md) routine to create this window.',
type: 'initialization'
},
{
name: 'ain1',
description: 'The stimulus sound. Must have high frequencies for best results.',
type: 'performance'
},
{
name: 'ain2',
description: 'The modulating sound. Must have a moving frequency response (like speech) for best results.',
type: 'performance'
},
{
name: 'kbias',
description: 'The amount of cross synthesis. 1 is the normal, 0 is no cross synthesis.',
type: 'performance'
},
],
seeAlso: ['Convolution and Morphing']
},
{
name: 'dconv',
type: 'opcode',
category: 'Signal Modifiers:Convolution and Morphing',
description: 'A direct convolution opcode.',
syntax: 'ares = dconv(asig, isize, ifn)',
example: '--8<-- "examples/dconv.csd"',
rates: ['a-rate', 'i-rate'],
parameters: [
{
name: 'isize',
description: 'the size of the convolution buffer to use. If the buffer size is smaller than the size of _ifn_, then only the first _isize_ values will be used from the table.',
type: 'initialization'
},
{
name: 'ifn',
description: 'table number of a stored function containing the impulse response for convolution.',
type: 'initialization'
},
],
seeAlso: ['Convolution and Morphing']
},
{
name: 'ftconv',
type: 'opcode',
category: 'Signal Modifiers:Convolution and Morphing',
description: 'Low latency multichannel convolution, using a function table as impulse response source.',
syntax: 'a1[, a2[, a3[, ... a8]]] = ftconv(ain, ift, iplen[, iskipsamples \\\n [, iirlen[, iskipinit]]])',
example: '--8<-- "examples/ftconv.csd"',
parameters: [
{
name: 'ift',
description: 'source ftable number. The table is expected to contain interleaved multichannel audio data, with the number of channels equal to the number of output variables (a1, a2, etc.). An interleaved table can be created from a set of mono tables with [GEN52](../scoregens/gen52.md).',
type: 'initialization'
},
{
name: 'iplen',
description: 'length of impulse response partitions, in sample frames; must be an integer power of two. Lower settings allow for shorter output delay, but will increase CPU usage.',
type: 'initialization'
},
{
name: 'ain',
description: 'input signal.',
type: 'performance'
},
],
seeAlso: ['Convolution and Morphing']
},
{
name: 'ftmorf',
type: 'opcode',
category: 'Signal Modifiers:Convolution and Morphing',
description: 'Uses an index into a table of ftable numbers to morph between adjacent tables in the list. This morphed function is written into the table referenced by _iresfn_ on every k-cycle.',
syntax: 'ftmorf(kftndx, iftfn, iresfn)',
example: '--8<-- "examples/ftmorf.csd"',
parameters: [
{
name: 'iftfn',
description: 'The table containing the numbers of any existing tables which are used for the morphing.',
type: 'initialization'
},
{
name: 'iresfn',
description: 'Table number of the morphed function',
type: 'initialization'
},
{
name: 'kftndx',
description: 'the index into the _iftfn_ table.',
type: 'performance'
},
],
seeAlso: ['Convolution and Morphing', 'Read/Write Operations']
},
{
name: 'liveconv',
type: 'opcode',
category: 'Signal Modifiers:Convolution and Morphing',
description: 'Partitioned convolution with dynamically reloadable impulse response.',
syntax: 'ares = liveconv(ain, ift, iplen, kupdate, kclear)',
example: '--8<-- "examples/liveconv.csd"',
rates: ['a-rate'],
parameters: [
{
name: 'ift',
description: 'table number for storing the impulse response (IR) for convolution. The table may be filled with new data at any time while the convolution is running.',
type: 'initialization'
},
{
name: 'iplen',
description: 'length of impulse response partition in samples; must be an integer power of two. Lower settings allow for shorter output delay, but will increase CPU usage.',
type: 'initialization'
},
{
name: 'ain',
description: 'input signal.',
type: 'performance'
},
{
name: 'ares',
description: 'output signal.',
type: 'performance'
},
{
name: 'kupdate',
description: 'flag indicating whether the IR table should be updated. If kupdate=1 the IR table ift is loaded partition by partition, starting with the next partition. If kupdate=-1 the IR table ift is unloaded (cleared to zero) partition by partition, starting with the next partition. Other values have no effect.',
type: 'performance'
},
{
name: 'kclear',
description: 'flag for clearing all internal buffers. If kclear has any value != zero, the internal buffers are cleared immediately. This operation is not free of artifacts.',
type: 'performance'
},
],
seeAlso: ['Convolution and Morphing']
},
{
name: 'pconvolve',
type: 'opcode',
category: 'Signal Modifiers:Convolution and Morphing',
description: 'Convolution based on a uniformly partitioned overlap-save algorithm.',
syntax: 'ar1 [, ar2 [, ar3 [, ar4]]] = pconvolve(ain, ifilcod [, ipartitionsize [, ichannel]])',
example: '--8<-- "examples/pconvolve.csd"',
parameters: [
{
name: 'ifilcod',
description: 'integer or character-string denoting an impulse response soundfile. Multichannel files are supported, the file must have the same sample-rate as the orc. [Note: _cvanal_ files cannot be used!] Keep in mind that longer files require more calculation time [and probably larger partition sizes and more latency]. At current processor speeds, files longer than a few seconds may not render in real-time.',
type: 'initialization'
},
{
name: 'ain',
description: 'input audio signal.',
type: 'performance'
},
],
seeAlso: ['Convolution and Morphing']
},
]