Files
oldboy/src/lib/csound-reference/signal-i-o-software-bus.ts
2025-10-15 15:05:23 +02:00

307 lines
10 KiB
TypeScript

import type { CsoundReference } from './types'
// Signal I/O:Software Bus
export const signalIOSoftwareBus: CsoundReference[] = [
{
name: 'chani',
type: 'opcode',
category: 'Signal I/O:Software Bus',
description: 'Reads data from a channel of the inward software bus.',
syntax: 'kval = chani(kchan)\n aval = chani(kchan)',
example: 'sr = 44100\nkr = 100\nksmps = 1\n\ninstr 1\n kc chani 1\n a1 oscil p4, p5, 100\n a2 lowpass2 a1, kc, 200\n out a2\nendin',
parameters: [
{
name: 'kchan',
description: 'a positive integer that indicates which channel of the software bus to read',
type: 'performance'
},
],
seeAlso: ['Software Bus']
},
{
name: 'chano',
type: 'opcode',
category: 'Signal I/O:Software Bus',
description: 'Send data to a channel of the outward software bus.',
syntax: 'chano(kval, kchan)\n chano(aval, kchan)',
example: 'sr = 44100\nkr = 100\nksmps = 1\n\ninstr 1\n a1 oscil p4, p5, 100\n chano 1, a1\nendin',
parameters: [
{
name: 'xval',
description: 'value to transmit',
type: 'performance'
},
{
name: 'kchan',
description: 'a positive integer that indicates which channel of the software bus to write',
type: 'performance'
},
],
seeAlso: ['Software Bus']
},
{
name: 'chn',
type: 'opcode',
category: 'Signal I/O:Software Bus',
description: 'Declare a channel of the named software bus.',
syntax: 'chn_k(Sname, imode[, itype, idflt, imin, ima, ix, iy, iwidth, iheight, Sattributes])\n chn_a(Sname, imode)\n chn_S(Sname, imode)\n chn_S(Sname, Smode)\n chn_array(Sname, imode, Stype, iSizes[])',
example: 'sr = 44100\nkr = 100\nksmps = 1\n\nchn_k "cutoff", 1, 3, 1000, 500, 2000\n\ninstr 1\n kc chnget "cutoff"\n a1 oscil p4, p5, 100\n a2 lowpass2 a1, kc, 200\n out a2\nendin',
parameters: [
{
name: 'imode',
description: 'sum of at least one of 1 for input and 2 for output.',
type: 'initialization'
},
{
name: 'Smode',
description: 'The mode can also be set with a string: "r" for input, "w" for output or "rw" for input/output',
type: 'initialization'
},
{
name: 'Stypes',
description: 'the array channel type ("k", "a", "S").',
type: 'initialization'
},
{
name: 'ix',
description: 'suggested x position for controller.',
type: 'initialization'
},
{
name: 'iy',
description: 'suggested y position for controller.',
type: 'initialization'
},
{
name: 'iwidth',
description: 'suggested width position for controller.',
type: 'initialization'
},
{
name: 'iheight',
description: 'suggested height position for controller.',
type: 'initialization'
},
{
name: 'Sattributes',
description: 'attributes for controller.',
type: 'initialization'
},
],
seeAlso: ['Software Bus']
},
{
name: 'chnclear',
type: 'opcode',
category: 'Signal I/O:Software Bus',
description: 'Clears a number of audio output channel of the named software bus.',
syntax: 'chnclear(Sname1[, Sname2,...])',
example: '--8<-- "examples/chnclear-modern.csd"',
seeAlso: ['Software Bus']
},
{
name: 'chnexport',
type: 'opcode',
category: 'Signal I/O:Software Bus',
description: 'Export a global variable as a channel of the bus.',
syntax: 'gival = chnexport(Sname, imode[, itype, idflt, imin, imax])\n gkval = chnexport(Sname, imode[, itype, idflt, imin, imax])\n gaval = chnexport(Sname, imode)\n gSval = chnexport(Sname, imode)',
example: 'sr = 44100\nkr = 100\nksmps = 1\n\ngkc init 1000 ; set default value\ngkc chnexport "cutoff", 1, 3, i(gkc), 500, 2000\n\ninstr 1\n a1 oscil p4, p5, 100\n a2 lowpass2 a1, gkc, 200\n out a2\nendin',
parameters: [
{
name: 'imode',
description: 'sum of at least one of 1 for input and 2 for output.',
type: 'initialization'
},
],
seeAlso: ['Software Bus']
},
{
name: 'chnget',
type: 'opcode',
category: 'Signal I/O:Software Bus',
description: 'Reads data from a channel of the inward named software bus.',
syntax: 'ival = chnget(Sname)\n kval = chnget(Sname)\n aval = chnget(Sname)\n Sval = chnget(Sname)\n Sval = chngetks(Sname)\n ival[] = chngeti(Sname[])\n kval[] = chngetk(Sname[])\n aval[] = chngeta(Sname[])\n Sval[] = chngets(Sname[])',
example: 'sr = 44100\nkr = 100\nksmps = 1\n\ninstr 1\n kc chnget "cutoff"\n a1 oscil p4, p5, 100\n a2 lowpass2 a1, kc, 200\n out a2\nendin',
parameters: [
{
name: 'Sname',
description: 'a string that identifies a channel of the named software bus to read.',
type: 'initialization'
},
{
name: 'ival',
description: 'the control value read at i-time.',
type: 'initialization'
},
{
name: 'Sval',
description: 'the string value read at i-time.',
type: 'initialization'
},
{
name: 'kval',
description: 'the control value read at performance time.',
type: 'performance'
},
{
name: 'aval',
description: 'the audio signal read at performance time.',
type: 'performance'
},
{
name: 'Sval',
description: 'the string value read at k-rate. The chnget opcode works both at i-time and perf-time, whereas chngetks works only at perf-time. String variables are only updated if the channel has changed.',
type: 'performance'
},
],
seeAlso: ['Software Bus']
},
{
name: 'chnmix',
type: 'opcode',
category: 'Signal I/O:Software Bus',
description: 'Writes audio data to the named software bus, mixing to the previous output.',
syntax: 'chnmix(aval, Sname)',
example: '--8<-- "examples/chnmix-modern.csd"',
parameters: [
{
name: 'Sname',
description: 'a string that indicates which named channel of the software bus to write.',
type: 'initialization'
},
{
name: 'aval',
description: 'the audio signal to write at performance time.',
type: 'performance'
},
],
seeAlso: ['Software Bus']
},
{
name: 'chnparams',
type: 'opcode',
category: 'Signal I/O:Software Bus',
description: 'Query parameters of a channel (if it does not exist, all returned values are zero).',
syntax: 'itype, imode, ictltype, idflt, imin, imax = chnparams(Sname)',
parameters: [
{
name: 'itype',
description: 'channel data type (1: control, 2: audio, 3: string)',
type: 'initialization'
},
{
name: 'imode',
description: 'sum of 1 for input and 2 for output',
type: 'initialization'
},
{
name: 'ictltype',
description: 'special parameter for control channel only; if not available, set to zero.',
type: 'initialization'
},
{
name: 'idflt',
description: 'special parameter for control channel only; if not available, set to zero.',
type: 'initialization'
},
{
name: 'imin',
description: 'special parameter for control channel only; if not available, set to zero.',
type: 'initialization'
},
{
name: 'imax',
description: 'special parameter for control channel only; if not available, set to zero.',
type: 'initialization'
},
{
name: 'Sname',
description: 'string identifying the channel.',
type: 'initialization'
},
],
seeAlso: ['Software Bus']
},
{
name: 'chnset',
type: 'opcode',
category: 'Signal I/O:Software Bus',
description: 'Writes data to a channel of the named software bus.',
syntax: 'chnset(ival, Sname)\n chnset(kval, Sname)\n chnset(aval, Sname)\n chnset(Sval, Sname)\n chnsetks(Sval, Sname)\n chnseti(ival[], []Sname)\n chnsetk(kval[], []Sname)\n chnseta(aval[], []Sname)\n chnsets(Sval[], []Sname)',
example: 'sr = 44100\nkr = 100\nksmps = 1\n\ninstr 1\n a1 in\n kp,ka pitchamdf a1\n chnset kp, "pitch"\nendin',
parameters: [
{
name: 'Sname',
description: 'a string that indicates which named channel of the software bus to write.',
type: 'initialization'
},
{
name: 'ival',
description: 'the control value to write at i-time.',
type: 'initialization'
},
{
name: 'Sval',
description: 'the string value to write at i-time.',
type: 'initialization'
},
{
name: 'kval',
description: 'the control value to write at performance time.',
type: 'performance'
},
{
name: 'aval',
description: 'the audio signal to write at performance time.',
type: 'performance'
},
{
name: 'Sval',
description: 'the string value to write at perf-time. The opcode chnset with strings works at both i- and perf-time, whereas chnsetks works only a perf-time. Channel contents are only updated if the string variable is modified.',
type: 'performance'
},
],
seeAlso: ['Software Bus']
},
{
name: 'oversample',
type: 'opcode',
category: 'Signal I/O:Software Bus',
description: 'Sets the local sampling rate value in a user-defined opcode block.',
syntax: 'oversample(ifactor [,icvt_in, icvt_out])',
parameters: [
{
name: 'ifactor',
description: 'sets the oversampling factor. It needs to be a positive integer &gt; 1. A factor of 1 is a non-op, zero or negative factors are illegal. The local sampling rate is set as ifactor * sr. The value of the sr variable is then changed locally. Local kr is also changed accordingly, local ksmps remains unchanged.',
type: 'initialization'
},
{
name: 'icvt_in',
description: 'converter used for input: if Secret Rabbit Code is used, then 0 - best quality sync (default); 1 - medium quality sync; 2 - fast sync; 3 - zero-order hold; and 4 - linear.',
type: 'initialization'
},
{
name: 'icvt_out',
description: 'converter used for output, defaults to the input converter, but can be different.',
type: 'initialization'
},
],
seeAlso: ['User Defined Opcodes (UDO)']
},
{
name: 'setksmps',
type: 'opcode',
category: 'Signal I/O:Software Bus',
description: 'Sets the local ksmps value in an instrument or user-defined opcode block.',
syntax: 'setksmps(iksmps)',
parameters: [
{
name: 'iksmps',
description: 'sets the local ksmps value.',
type: 'initialization'
},
],
seeAlso: ['User Defined Opcodes (UDO)']
},
]