Files
oldboy/src/lib/csound-reference/real-time-midi-input.ts
2025-10-15 15:05:23 +02:00

693 lines
20 KiB
TypeScript

import type { CsoundReference } from './types'
// Real-time MIDI:Input
export const realTimeMidiInput: CsoundReference[] = [
{
name: 'aftouch',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Get the current after-touch value for this channel.',
syntax: 'kaft = aftouch([imin] [, imax])',
example: '--8<-- "examples/aftouch-modern.csd"',
seeAlso: ['MIDI input and Initialization']
},
{
name: 'chanctrl',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Get the current value of a MIDI channel controller and optionally map it onto specified range.',
syntax: 'ival = chanctrl(ichnl, ictlno [, ilow] [, ihigh])\n kval = chanctrl(ichnl, ictlno [, ilow] [, ihigh])',
example: '--8<-- "examples/chanctrl-modern.csd"',
parameters: [
{
name: 'ichnl',
description: 'the MIDI channel (1-16).',
type: 'initialization'
},
{
name: 'ictlno',
description: 'the MIDI controller number (0-127).',
type: 'initialization'
},
{
name: 'ilow',
description: 'low and high ranges for mapping',
type: 'initialization'
},
{
name: 'ihigh',
description: 'low and high ranges for mapping',
type: 'initialization'
},
],
seeAlso: ['MIDI input and Initialization']
},
{
name: 'ctrl14',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Allows a floating-point 14-bit MIDI signal scaled with a minimum and a maximum range.',
syntax: 'idest = ctrl14(ichan, ictlno1, ictlno2, imin, imax [, ifn])\n kdest = ctrl14(ichan, ictlno1, ictlno2, kmin, kmax [, ifn])',
example: '--8<-- "examples/ctrl14.csd"',
rates: ['i-rate'],
parameters: [
{
name: 'idest',
description: 'output signal',
type: 'initialization'
},
{
name: 'ichan',
description: 'MIDI channel number (1-16)',
type: 'initialization'
},
{
name: 'ictln1o',
description: 'most-significant byte controller number (0-127)',
type: 'initialization'
},
{
name: 'ictlno2',
description: 'least-significant byte controller number (0-127)',
type: 'initialization'
},
{
name: 'imin',
description: 'user-defined minimum floating-point value of output',
type: 'initialization'
},
{
name: 'imax',
description: 'user-defined maximum floating-point value of output',
type: 'initialization'
},
{
name: 'kdest',
description: 'output signal',
type: 'performance'
},
{
name: 'kmin',
description: 'user-defined minimum floating-point value of output',
type: 'performance'
},
{
name: 'kmax',
description: 'user-defined maximum floating-point value of output',
type: 'performance'
},
],
seeAlso: ['MIDI input and Initialization']
},
{
name: 'ctrl21',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Allows a floating-point 21-bit MIDI signal scaled with a minimum and a maximum range.',
syntax: 'idest = ctrl21(ichan, ictlno1, ictlno2, ictlno3, imin, imax [, ifn])\n kdest = ctrl21(ichan, ictlno1, ictlno2, ictlno3, kmin, kmax [, ifn])',
example: '--8<-- "examples/ctrl21.csd"',
rates: ['i-rate'],
parameters: [
{
name: 'idest',
description: 'output signal',
type: 'initialization'
},
{
name: 'ichan',
description: 'MIDI channel number (1-16)',
type: 'initialization'
},
{
name: 'ictlno1',
description: 'most-significant byte controller number (0-127)',
type: 'initialization'
},
{
name: 'ictlno2',
description: 'mid-significant byte controller number (0-127)',
type: 'initialization'
},
{
name: 'ictlno3',
description: 'least-significant byte controller number (0-127)',
type: 'initialization'
},
{
name: 'imin',
description: 'user-defined minimum floating-point value of output',
type: 'initialization'
},
{
name: 'imax',
description: 'user-defined maximum floating-point value of output',
type: 'initialization'
},
{
name: 'kdest',
description: 'output signal',
type: 'performance'
},
{
name: 'kmin',
description: 'user-defined minimum floating-point value of output',
type: 'performance'
},
{
name: 'kmax',
description: 'user-defined maximum floating-point value of output',
type: 'performance'
},
],
seeAlso: ['MIDI input and Initialization']
},
{
name: 'ctrl7',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Allows a floating-point 7-bit MIDI signal scaled with a minimum and a maximum range.',
syntax: 'idest = ctrl7(ichan, ictlno, imin, imax [, ifn])\n kdest = ctrl7(ichan, ictlno, kmin, kmax [, ifn])\n adest = ctrl7(ichan, ictlno, kmin, kmax [, ifn] [, icutoff])',
example: '--8<-- "examples/ctrl7.csd"',
rates: ['i-rate'],
parameters: [
{
name: 'idest',
description: 'output signal',
type: 'initialization'
},
{
name: 'ichan',
description: 'MIDI channel (1-16)',
type: 'initialization'
},
{
name: 'ictlno',
description: 'MIDI controller number (0-127)',
type: 'initialization'
},
{
name: 'imin',
description: 'user-defined minimum floating-point value of output',
type: 'initialization'
},
{
name: 'imax',
description: 'user-defined maximum floating-point value of output',
type: 'initialization'
},
{
name: 'kdest',
description: 'output signal',
type: 'performance'
},
{
name: 'adest',
description: 'output signal',
type: 'performance'
},
{
name: 'kmin',
description: 'user-defined minimum floating-point value of output',
type: 'performance'
},
{
name: 'kmax',
description: 'user-defined maximum floating-point value of output',
type: 'performance'
},
],
seeAlso: ['MIDI input and Initialization']
},
{
name: 'ctrlinit',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Sets the initial values for a set of MIDI controllers.',
syntax: 'ctrlinit(ichnl, ictlno1, ival1 [, ictlno2] [, ival2] [, ictlno3] \\\n [, ival3] [,...ival32])',
example: '--8<-- "examples/ctrlinit.csd"',
parameters: [
{
name: 'ichnl',
description: 'MIDI channel number (1-16)',
type: 'initialization'
},
],
seeAlso: ['MIDI input and Initialization', 'Orchestra Header Statements']
},
{
name: 'ctrlpreset',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Defines a preset for MIDI controllers.',
syntax: 'kpreset = ctrlpreset(ktag, kchnl, kctlno1, [kctlno2] [, kctlno3] ...)',
example: '--8<-- "examples/ctrls.csd"',
parameters: [
{
name: 'kpreset',
description: 'the numeric tag for where the preset it stored. If ktag is not zero kpreset will be the same as ktag.',
type: 'performance'
},
{
name: 'ktag',
description: 'the tag for this preset; either a strictly positive integer or zero if the system is to allocate an unused preset.',
type: 'performance'
},
{
name: 'kchanl',
description: 'the MIDI channel to which the preset refers.',
type: 'performance'
},
],
seeAlso: ['MIDI input and Initialization']
},
{
name: 'ctrlprint',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Print the saved values of MIDI controllers from an array to the console or a file.',
syntax: 'ctrlprint(kcont[][, Sfile])',
example: '--8<-- "examples/ctrls.csd"',
parameters: [
{
name: 'Sfile',
description: 'File name to receive the values. If omitted it writes to the console.',
type: 'initialization'
},
{
name: 'kcont',
description: 'the array of controls as saved by _ctrlsave_.',
type: 'performance'
},
],
seeAlso: ['MIDI input and Initialization']
},
{
name: 'ctrlprintpresets',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Prints the current collection of presets for MIDI controllers in a format that can be used in an orchestra, to the console or a file.',
syntax: 'ctrlprintpresets([Sfilenam])',
example: '--8<-- "examples/ctrls.csd"',
parameters: [
{
name: 'Sfilename',
description: '(optional) file to which to print. If omitted it uses the current output.',
type: 'performance'
},
],
seeAlso: ['MIDI input and Initialization']
},
{
name: 'ctrlsave',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Recovers the current values of MIDI controllers to a k-array.',
syntax: 'kconnt[] = ctrlsave(ichnl, ictlno1, [ictlno2] [, ictlno3] ...)',
example: '--8<-- "examples/ctrls.csd"',
parameters: [
{
name: 'ichnl',
description: 'MIDI channel number (1-16)',
type: 'initialization'
},
],
seeAlso: ['MIDI input and Initialization']
},
{
name: 'ctrlselect',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Loads a preset of values for MIDI controllers from a previous ctrlpreset call.',
syntax: 'ctrlselect(kpre)',
example: '--8<-- "examples/ctrls.csd"',
parameters: [
{
name: 'kpre',
description: 'the numeric tag for the preset, as returned by ctrlpreset.',
type: 'performance'
},
],
seeAlso: ['MIDI input and Initialization']
},
{
name: 'initc14',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Initializes the controllers used to create a 14-bit MIDI value.',
syntax: 'initc14(ichan, ictlno1, ictlno2, ivalue)',
parameters: [
{
name: 'ichan',
description: 'MIDI channel (1-16)',
type: 'initialization'
},
{
name: 'ictlno1',
description: 'most significant byte controller number (0-127)',
type: 'initialization'
},
{
name: 'ictlno2',
description: 'least significant byte controller number (0-127)',
type: 'initialization'
},
{
name: 'ivalue',
description: 'floating point value (must be within 0 to 1)',
type: 'initialization'
},
],
seeAlso: ['MIDI input and Initialization']
},
{
name: 'initc21',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Initializes the controllers used to create a 21-bit MIDI value.',
syntax: 'initc21(ichan, ictlno1, ictlno2, ictlno3, ivalue)',
parameters: [
{
name: 'ichan',
description: 'MIDI channel (1-16)',
type: 'initialization'
},
{
name: 'ictlno1',
description: 'most significant byte controller number (0-127)',
type: 'initialization'
},
{
name: 'ictlno2',
description: 'medium significant byte controller number (0-127)',
type: 'initialization'
},
{
name: 'ictlno3',
description: 'least significant byte controller number (0-127)',
type: 'initialization'
},
{
name: 'ivalue',
description: 'floating point value (must be within 0 to 1)',
type: 'initialization'
},
],
seeAlso: ['MIDI input and Initialization']
},
{
name: 'initc7',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Initializes the controller used to create a 7-bit MIDI value.',
syntax: 'initc7(ichan, ictlno, ivalue)',
example: '--8<-- "examples/initc7.csd"',
parameters: [
{
name: 'ichan',
description: 'MIDI channel (1-16)',
type: 'initialization'
},
{
name: 'ictlno',
description: 'controller number (0-127)',
type: 'initialization'
},
{
name: 'ivalue',
description: 'floating point value (must be within 0 to 1)',
type: 'initialization'
},
],
seeAlso: ['MIDI input and Initialization']
},
{
name: 'massign',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Assigns a MIDI channel number to a Csound instrument.',
syntax: 'massign(ichnl, insnum[, ireset])\n massign(ichnl, "insname"[, ireset])',
example: '--8<-- "examples/massign.csd"',
parameters: [
{
name: 'ichnl',
description: 'MIDI channel number (1-16).',
type: 'initialization'
},
{
name: 'insnum',
description: 'Csound orchestra instrument number. If zero or negative, the channel is muted (i.e. it does not trigger a csound instrument, though information will still be received by opcodes like [midiin](../opcodes/midiin.md)).',
type: 'initialization'
},
{
name: 'ireset',
description: 'If non-zero resets the controllers; default is to reset.',
type: 'initialization'
},
],
seeAlso: ['MIDI input and Initialization', 'Orchestra Header Statements']
},
{
name: 'midic14',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Allows a floating-point 14-bit MIDI signal scaled with a minimum and a maximum range.',
syntax: 'idest = midic14(ictlno1, ictlno2, imin, imax [, ifn])\n kdest = midic14(ictlno1, ictlno2, kmin, kmax [, ifn])',
example: '--8<-- "examples/midic14.csd"',
rates: ['i-rate'],
parameters: [
{
name: 'idest',
description: 'output signal',
type: 'initialization'
},
{
name: 'ictln1o',
description: 'most-significant byte controller number (0-127)',
type: 'initialization'
},
{
name: 'ictlno2',
description: 'least-significant byte controller number (0-127)',
type: 'initialization'
},
{
name: 'imin',
description: 'user-defined minimum floating-point value of output',
type: 'initialization'
},
{
name: 'imax',
description: 'user-defined maximum floating-point value of output',
type: 'initialization'
},
{
name: 'kdest',
description: 'output signal',
type: 'performance'
},
{
name: 'kmin',
description: 'user-defined minimum floating-point value of output',
type: 'performance'
},
{
name: 'kmax',
description: 'user-defined maximum floating-point value of output',
type: 'performance'
},
],
seeAlso: ['MIDI input and Initialization']
},
{
name: 'midic21',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Allows a floating-point 21-bit MIDI signal scaled with a minimum and a maximum range.',
syntax: 'idest = midic21(ictlno1, ictlno2, ictlno3, imin, imax [, ifn])\n kdest = midic21(ictlno1, ictlno2, ictlno3, kmin, kmax [, ifn])',
example: '--8<-- "examples/midic21.csd"',
rates: ['i-rate'],
parameters: [
{
name: 'idest',
description: 'output signal',
type: 'initialization'
},
{
name: 'ictln1o',
description: 'most-significant byte controller number (0-127)',
type: 'initialization'
},
{
name: 'ictlno2',
description: 'mid-significant byte controller number (0-127)',
type: 'initialization'
},
{
name: 'ictlno3',
description: 'least-significant byte controller number (0-127)',
type: 'initialization'
},
{
name: 'imin',
description: 'user-defined minimum floating-point value of output',
type: 'initialization'
},
{
name: 'imax',
description: 'user-defined maximum floating-point value of output',
type: 'initialization'
},
{
name: 'kdest',
description: 'output signal',
type: 'performance'
},
{
name: 'kmin',
description: 'user-defined minimum floating-point value of output',
type: 'performance'
},
{
name: 'kmax',
description: 'user-defined maximum floating-point value of output',
type: 'performance'
},
],
seeAlso: ['MIDI input and Initialization']
},
{
name: 'midic7',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Allows a floating-point 7-bit MIDI signal scaled with a minimum and a maximum range.',
syntax: 'idest = midic7(ictlno, imin, imax [, ifn])\n kdest = midic7(ictlno, kmin, kmax [, ifn])',
example: '--8<-- "examples/midic7.csd"',
rates: ['i-rate'],
parameters: [
{
name: 'idest',
description: 'output signal',
type: 'initialization'
},
{
name: 'ictlno',
description: 'MIDI controller number (0-127)',
type: 'initialization'
},
{
name: 'imin',
description: 'user-defined minimum floating-point value of output',
type: 'initialization'
},
{
name: 'imax',
description: 'user-defined maximum floating-point value of output',
type: 'initialization'
},
{
name: 'kdest',
description: 'output signal',
type: 'performance'
},
{
name: 'kmin',
description: 'user-defined minimum floating-point value of output',
type: 'performance'
},
{
name: 'kmax',
description: 'user-defined maximum floating-point value of output',
type: 'performance'
},
],
seeAlso: ['MIDI input and Initialization']
},
{
name: 'midictrl',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Get the current value (0-127) of a specified MIDI controller.',
syntax: 'ival = midictrl(inum [, imin] [, imax])\n kval = midictrl(inum [, imin] [, imax])',
example: '--8<-- "examples/midictrl.csd"',
parameters: [
{
name: 'inum',
description: 'MIDI controller number (0-127)',
type: 'initialization'
},
{
name: 'imin',
description: 'set minimum and maximum limits on values obtained.',
type: 'initialization'
},
{
name: 'imax',
description: 'set minimum and maximum limits on values obtained.',
type: 'initialization'
},
],
seeAlso: ['MIDI input and Initialization']
},
{
name: 'notnum',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Get a note number from a MIDI event.',
syntax: 'ival = notnum()',
example: '--8<-- "examples/notnum.csd"',
seeAlso: ['MIDI input and Initialization']
},
{
name: 'pchbend',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Get the current pitch-bend value for this channel.',
syntax: 'ibend = pchbend([imin] [, imax])\n kbend = pchbend([imin] [, imax])',
example: '--8<-- "examples/pchbend.csd"',
seeAlso: ['MIDI input and Initialization']
},
{
name: 'pgmassign',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Assigns an instrument number to a specified MIDI program.',
syntax: 'pgmassign(ipgm, inst[, ichn])\n pgmassign(ipgm, "insname"[, ichn])',
example: '--8<-- "examples/pgmassign.csd"',
parameters: [
{
name: 'ipgm',
description: 'MIDI program number (1 to 128). A value of zero selects all programs.',
type: 'initialization'
},
{
name: 'inst',
description: 'instrument number. If set to zero, or negative, MIDI program changes to _ipgm_ are ignored. Currently, assignment to an instrument that does not exist has the same effect. This may be changed in a later release to print an error message.',
type: 'initialization'
},
],
seeAlso: ['MIDI input and Initialization', 'Orchestra Header Statements']
},
{
name: 'polyaft',
type: 'opcode',
category: 'Real-time MIDI:Input',
description: 'Returns the polyphonic after-touch pressure of the selected note number, optionally mapped to an user-specified range.',
syntax: 'ires = polyaft(inote [, ilow] [, ihigh])\n kres = polyaft(inote [, ilow] [, ihigh])',
example: '--8<-- "examples/polyaft.csd"',
rates: ['k-rate', 'i-rate'],
parameters: [
{
name: 'inote',
description: 'note number. Normally set to the value returned by [notnum](../opcodes/notnum.md)',
type: 'initialization'
},
{
name: 'kres',
description: 'polyphonic pressure (aftertouch).',
type: 'performance'
},
],
seeAlso: ['MIDI input and Initialization']
},
]