import type { CsoundReference } from './types' // Instrument Control:Sensing and Control export const instrumentControlSensingAndControl: CsoundReference[] = [ { name: 'button', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Sense on-screen controls. Requires Winsound or TCL/TK.', syntax: 'kres = button(knum)', example: '--8<-- "examples/checkbox.csd"', rates: ['k-rate'], parameters: [ { name: 'kres', description: 'value of the button control. If the button has been pushed since the last k-period, then return 1, otherwise return 0.', type: 'performance' }, { name: 'knum', description: 'the number of the button. If it does not exist, it is made on-screen at initialization.', type: 'performance' }, ], seeAlso: ['Sensing and Control: TCL/TK widgets'] }, { name: 'changed', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'k-rate signal change detector.', syntax: 'ktrig = changed(kvar1 [, kvar2,..., kvarN])', example: '--8<-- "examples/changed-modern.csd"', parameters: [ { name: 'ktrig', description: 'Outputs a value of 1 when any of the k-rate signals has changed, otherwise outputs 0.', type: 'performance' }, ], seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, { name: 'changed2', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'k-rate signal change detector.', syntax: 'ktrig = changed2(kvar1 [, kvar2,..., kvarN])\n ktrig = changed2(karr[])\n ktrig = changed2(aarr[])', example: '--8<-- "examples/changed2-modern.csd"', parameters: [ { name: 'ktrig', description: 'Outputs a value of 1 when any of the k-rate signals has changed, or any value in the array, otherwise outputs 0.', type: 'performance' }, { name: 'xarray', description: 'any array type.', type: 'performance' }, ], seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, { name: 'checkbox', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Sense on-screen controls. Requires Winsound or TCL/TK.', syntax: 'kres = checkbox(knum)', example: '--8<-- "examples/checkbox-modern.csd"', rates: ['k-rate'], parameters: [ { name: 'kres', description: 'value of the checkbox control. If the checkbox is set (pushed) then return 1, if not, return 0.', type: 'performance' }, { name: 'knum', description: 'the number of the checkbox. If it does not exist, it is made on-screen at initialization.', type: 'performance' }, ], seeAlso: ['Sensing and Control: TCL/TK widgets'] }, { name: 'cntDelete', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Delete a counter and render any memory used.', syntax: 'kval = cntDelete(icnt)', parameters: [ { name: 'icnt', description: 'the handle of a counter object from a call to _cntCreate_.', type: 'initialization' }, { name: 'kval', description: 'the handle deleted or a negative number if there was no such counter.', type: 'performance' }, ], seeAlso: ['Program Flow Control: Counter'] }, { name: 'cntDelete_i', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Delete a counter.', syntax: 'ival = cntDelete_i(icnt)', parameters: [ { name: 'icnt', description: 'the handle of a counter object from a call to _cntCreate_.', type: 'initialization' }, { name: 'ival', description: 'the handle deleted or a negative number if there was no such counter.', type: 'performance' }, ], seeAlso: ['Program Flow Control: Counter'] }, { name: 'cntCreate', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Create a counter object.', syntax: 'icnt = cntCreate([imax, imin, inc])', example: '--8<-- "examples/counter.csd"', parameters: [ { name: 'imax', description: 'optional maximum value for the counter, defaulting to 1.', type: 'initialization' }, { name: 'imin', description: 'optional minimun value for the counter, defaulting to 0.', type: 'initialization' }, { name: 'inc', description: 'optional increment for the counter, defaulting to 1.', type: 'initialization' }, { name: 'icnt', description: 'a handle for the counter.', type: 'initialization' }, ], seeAlso: ['Program Flow Control: Counter'] }, { name: 'cntCycles', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Get the number of times a counter has cycled.', syntax: 'kval = cntCycles(icnt)', parameters: [ { name: 'icnt', description: 'the handle of a counter object from a call to _cntCreate_.', type: 'initialization' }, { name: 'kval', description: 'returned value.', type: 'performance' }, ], seeAlso: ['Program Flow Control: Counter'] }, { name: 'cntRead', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Read current value of a counter object without changing it.', syntax: 'kval = cntRead(icnt)', parameters: [ { name: 'icnt', description: 'a handle for the counter.', type: 'initialization' }, ], seeAlso: ['Program Flow Control: Counter'] }, { name: 'cntReset', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Resets a counter object to its initial state.', syntax: 'cntReset(icnt)', parameters: [ { name: 'icnt', description: 'a handle for the counter.', type: 'initialization' }, ], seeAlso: ['Program Flow Control: Counter'] }, { name: 'cntState', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Gives the range and increment of a counter.', syntax: 'kmax, kmin, kinc = cntState(icnt)', parameters: [ { name: 'icnt', description: 'a handle for the counter.', type: 'initialization' }, ], seeAlso: ['Program Flow Control: Counter'] }, { name: 'control', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Configurable slider controls for realtime user input. Requires Winsound or TCL/TK. It reads a slider\'s value.', syntax: 'kres = control(knum)', rates: ['k-rate'], parameters: [ { name: 'knum', description: 'number of the slider to be read.', type: 'performance' }, ], seeAlso: ['Sensing and Control: TCL/TK widgets'] }, { name: 'count', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Get the next value from a counter.', syntax: 'kval = count(icnt)', example: '--8<-- "examples/counter.csd"', parameters: [ { name: 'icnt', description: 'the handle of a counter object from a call to _cntCreate_.', type: 'initialization' }, { name: 'kval', description: 'returned value.', type: 'performance' }, ], seeAlso: ['Program Flow Control: Counter'] }, { name: 'count_i', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Get the next value from a counter.', syntax: 'ival = count_i(icnt)', example: '--8<-- "examples/counter.csd"', parameters: [ { name: 'icnt', description: 'the handle of a counter object from a call to _cntCreate_.', type: 'initialization' }, { name: 'ival', description: 'returned value.', type: 'performance' }, ], seeAlso: ['Program Flow Control: Counter'] }, { name: 'follow', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Envelope follower unit generator.', syntax: 'ares = follow(asig, idt)', example: '--8<-- "examples/follow.csd"', rates: ['a-rate'], parameters: [ { name: 'idt', description: 'This is the period, in seconds, that the average amplitude of _asig_ is reported. If the frequency of _asig_ is low then _idt_ must be large (more than half the period of _asig_ )', type: 'initialization' }, { name: 'asig', description: 'This is the signal from which to extract the envelope.', type: 'performance' }, ], seeAlso: ['Sensing and Control: Envelope followers'] }, { name: 'follow2', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Another controllable envelope extractor using the algorithm attributed to Jean-Marc Jot.', syntax: 'ares = follow2(asig, katt, krel)', example: '--8<-- "examples/follow2.csd"', rates: ['a-rate'], parameters: [ { name: 'asig', description: 'the input signal whose envelope is followed', type: 'performance' }, { name: 'katt', description: 'the attack rate (60dB attack time in seconds)', type: 'performance' }, { name: 'krel', description: 'the decay rate (60dB decay time in seconds)', type: 'performance' }, ], seeAlso: ['Sensing and Control: Envelope followers'] }, { name: 'getcfg', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Return various configuration settings in Svalue as a string at init time.', syntax: 'Svalue = getcfg(iopt)', example: '--8<-- "examples/getcfg.csd"', parameters: [ { name: 'iopt', description: 'The parameter to be returned, can be one of:', type: 'initialization' }, ], seeAlso: ['Sensing and Control: System'] }, { name: 'joystick', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Reads data from a Linux joystick controller.', syntax: 'kres = joystick(kdevice, ktab)', example: '--8<-- "examples/joystick.csd"', rates: ['k-rate'], parameters: [ { name: 'kdevice', description: 'the index of the joystick device, either /dev/js_N_ or /dev/input/js_N_.', type: 'performance' }, { name: 'ktab', description: 'A table to hold input results, should be at least enough elements to store one value for each stick axis and one for each button + 2. The first two elements of the table are initialized with the number of axes and the number of buttons, respectively, when a joystick is opened. If a joystick is unplugged during performance, the opcode will repeatedly attempt to reopen the device with a delay between attempts.', type: 'performance' }, ], seeAlso: ['Sensing and Control: Keyboard and mouse sensing', 'non-MIDI devices'] }, { name: 'metro', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Trigger Metronome.', syntax: 'ktrig = metro( kfreq [, initphase])', example: '--8<-- "examples/metro.csd"', parameters: [ { name: 'initphase', description: 'initial phase value (in the 0 to 1 range)', type: 'initialization' }, { name: 'ktrig', description: 'output trigger signal', type: 'performance' }, { name: 'kfreq', description: 'frequency of trigger bangs in cps', type: 'performance' }, ], seeAlso: ['Sensing and Control: Tempo and Sequencing', 'https://flossmanual.csound.com/csound-language/control-structures'] }, { name: 'metro2', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Trigger Metronome with Swing and Accents.', syntax: 'ktrig = metro2( kfreq, kswing [, iamp, initphase])', example: '--8<-- "examples/metro2.csd"', parameters: [ { name: 'iamp', description: 'off-beat click amplitude', type: 'initialization' }, { name: 'initphase', description: 'initial phase value (in the 0 to 1 range)', type: 'initialization' }, { name: 'ktrig', description: 'output trigger signal', type: 'performance' }, { name: 'kfreq', description: 'frequency of trigger bangs in cps', type: 'performance' }, { name: 'kswing', description: 'value (in the 0 to 1 range)', type: 'performance' }, ], seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, { name: 'metrobpm', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Trigger Metronome with optional gate.', syntax: 'ktrig = metrobpm( kfreq [, initphase] [, kgate])', parameters: [ { name: 'initphase', description: 'initial phase value (in the 0 to 1 range)', type: 'initialization' }, { name: 'ktrig', description: 'output trigger signal', type: 'performance' }, { name: 'kfreq', description: 'frequency of trigger bangs in beats per minute', type: 'performance' }, { name: 'kgate', description: 'proportion of the cycle that the trigger held at one', type: 'performance' }, ], seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, { name: 'midifilein', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Returns a generic MIDI message from a MIDI file.', syntax: 'status:i,chan:i,data1:i,data2:i,time:i = midifilein(index:i,[id:i])\n status:k, chan:k, data1:k, data2:k, time:k = midifilein(index:k,[id:k])', example: '--8<-- "examples/midifilein.csd"', seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, { name: 'midifilelen', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Returns the length of a MIDI file.', syntax: 'len:i = midifilelen([id:i])', example: '--8<-- "examples/midifilelen.csd"', seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, { name: 'midifilemute', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Toggle-mutes playback of a MIDI file (without pausing playback).', syntax: 'midifilemute([id:i])', example: '--8<-- "examples/midifilemute.csd"', seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, { name: 'midifileopen', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Open a MIDI file for playback.', syntax: 'id:i = midfileopen(name:S[,port:i])', example: '--8<-- "examples/midifileopen.csd"', parameters: [ { name: 'name', description: 'MIDI file name.', type: 'initialization' }, ], seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, { name: 'midifilepause', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Pauses MIDI file playback.', syntax: 'midifilepause([id:i])', example: '--8<-- "examples/midifilepause.csd"', seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, { name: 'midifileplay', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Starts playback of a MIDI file.', syntax: 'midifileplay([id:i])', example: '--8<-- "examples/midifileplay.csd"', seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, { name: 'midifilepos', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Gets/Sets the playback position of a MIDI file.', syntax: 'pos:i = midifilepos([id:i])\n pos:k = midifilepos([id:i])\n midifilepos(pos:i[,id:i])\n midifilepos(pos:k[,id:i])', example: '--8<-- "examples/midifilepos.csd"', parameters: [ { name: 'pos', description: 'playback position in seconds', type: 'initialization' }, ], seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, { name: 'midifilerewind', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Rewinds playback of a MIDI file.', syntax: 'midifilerewind([id:i])', example: '--8<-- "examples/midifilerewind.csd"', seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, { name: 'midifiletempo', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Sets the playback tempo of a MIDI file.', syntax: 'midifiletempo(tempo:i[,id:i])\n midifiletempo(tempo:k[,id:i])', example: '--8<-- "examples/midifiletempo.csd"', parameters: [ { name: 'tempo', description: 'if positive, the bpm to set. If negative, the absolute value is used as a tempo scaling parameter (playback speed).', type: 'initialization' }, ], seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, { name: 'midifilevents', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Returns the number of events in a MIDI file.', syntax: 'num:i = midifilevents([id:i])', example: '--8<-- "examples/midifilevents.csd"', seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, { name: 'miditempo', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Returns the current tempo at k-rate, of either the MIDI file (if available) or the score. (provided the -t option is used).', syntax: 'itempo = miditempo([id:i])\n ktempo = miditempo([id:i])', example: '--8<-- "examples/miditempo.csd"', seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, { name: 'pcount', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Returns the number of pfields belonging to a note event.', syntax: 'icount = pcount()', example: '--8<-- "examples/pcount.csd"', parameters: [ { name: 'icount', description: 'stores the number of pfields for the current note event.', type: 'initialization' }, ], seeAlso: ['Sensing and Control: Score control'] }, { name: 'peak', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Maintains the output equal to the highest absolute value received.', syntax: 'kres = peak(asig)\n kres = peak(ksig)', example: '--8<-- "examples/peak.csd"', rates: ['a-rate', 'k-rate'], parameters: [ { name: 'kres', description: 'Output equal to the highest absolute value received so far. This is effectively an input to the opcode as well, since it reads _kres_ in order to decide whether to write something higher into it.', type: 'performance' }, { name: 'ksig', description: 'k-rate input signal.', type: 'performance' }, { name: 'asig', description: 'a-rate input signal.', type: 'performance' }, ], seeAlso: ['Sensing and Control: Envelope followers'] }, { name: 'pindex', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Returns the value of a specified pfield.', syntax: 'ivalue = pindex(ipfieldIndex)', example: '--8<-- "examples/pindex.csd"', parameters: [ { name: 'ipfieldIndex', description: 'pfield number to query.', type: 'initialization' }, { name: 'ivalue', description: 'value of the pfield.', type: 'initialization' }, ], seeAlso: ['Sensing and Control: Score control'] }, { name: 'pitch', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Tracks the pitch of a signal.', syntax: 'koct, kamp = pitch(asig, iupdte, ilo, ihi, idbthresh [, ifrqs] [, iconf] \\\n [, istrt] [, iocts] [, iq] [, inptls] [, irolloff] [, iskip])', example: '--8<-- "examples/pitch.csd"', rates: ['a-rate', 'k-rate'], parameters: [ { name: 'iupdte', description: 'length of period, in seconds, that outputs are updated', type: 'initialization' }, { name: 'ilo', description: 'range in which pitch is detected, expressed in octave point decimal', type: 'initialization' }, { name: 'ihi', description: 'range in which pitch is detected, expressed in octave point decimal', type: 'initialization' }, { name: 'idbthresh', description: 'amplitude, expressed in decibels, necessary for the pitch to be detected. Once started it continues until it is 6 dB down.', type: 'initialization' }, { name: 'koct', description: 'The pitch output, given in the octave point decimal format.', type: 'performance' }, { name: 'kamp', description: 'The amplitude output.', type: 'performance' }, ], seeAlso: ['Sensing and Control: Tempo and Pitch estimation'] }, { name: 'pitchamdf', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Follows the pitch of a signal based on the AMDF method (Average Magnitude Difference Function).', syntax: 'kcps, krms = pitchamdf(asig, imincps, imaxcps [, icps] [, imedi] \\\n [, idowns] [, iexcps] [, irmsmedi])', example: '--8<-- "examples/pitchamdf.csd"', rates: ['a-rate', 'k-rate'], parameters: [ { name: 'imincps', description: 'estimated minimum frequency (expressed in Hz) present in the signal', type: 'initialization' }, { name: 'imaxcps', description: 'estimated maximum frequency present in the signal', type: 'initialization' }, { name: 'kcps', description: 'pitch tracking output', type: 'performance' }, { name: 'krms', description: 'amplitude tracking output', type: 'performance' }, ], seeAlso: ['Sensing and Control: Tempo and Pitch estimation'] }, { name: 'plltrack', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Tracks the pitch of a signal.', syntax: 'acps, alock = plltrack(asig, kd [, kloopf, kloopq, klf, khf, kthresh])', example: '--8<-- "examples/plltrack.csd"', rates: ['a-rate'], parameters: [ { name: 'acps', description: 'estimated pitch in Hz.', type: 'performance' }, { name: 'alock', description: 'phase lock indicator, a phase error indicating the quality of the tracking, with values between 0 and 1. Higher values indicate good tracking', type: 'performance' }, { name: 'kd', description: 'PLL feedback gain, controls frequency range of PLL (between 0 and 1). Higher values increase the range of the tracking.', type: 'performance' }, { name: 'kloopf', description: 'PLL LP filter cf, controls frequency range of PLL (opt, defaults to 20Hz).', type: 'performance' }, { name: 'kloopq', description: 'PLL LP filter Q, controls rise time of FO step (opt, defaults to 1/3)', type: 'performance' }, { name: 'klf', description: 'lowest tracking freq (opt, defaults to 20Hz)', type: 'performance' }, { name: 'khf', description: 'highest tracking freq (opt, defaults to 1500Hz)', type: 'performance' }, { name: 'kthresh', description: 'tracking signal level threshold (optional, defaults to 0.001, equiv to -60dBfs)', type: 'performance' }, ], seeAlso: ['Sensing and Control: Tempo and Pitch estimation'] }, { name: 'ptrack', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Tracks the pitch of a signal.', syntax: 'kcps, kamp = ptrack(asig, ihopsize[,ipeaks])', example: '--8<-- "examples/ptrack.csd"', rates: ['a-rate', 'k-rate'], parameters: [ { name: 'ihopsize', description: 'size of the analysis \'hop\', in samples, required to be power-of-two (min 64, max 4096). This is the period between measurements.', type: 'initialization' }, { name: 'ipeaks', description: 'number of spectral peaks to use in the analysis, defaults to 20 (optional)', type: 'initialization' }, { name: 'ihi', description: 'number of spectral peaks to use in the analysis, defaults to 20 (optional)', type: 'initialization' }, { name: 'kcps', description: 'estimated pitch in Hz.', type: 'performance' }, { name: 'kamp', description: 'estimated amplitude in dB relative to full-scale (0dB) (ie. always <= 0).', type: 'performance' }, ], seeAlso: ['Sensing and Control: Tempo and Pitch estimation'] }, { name: 'readscratch', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Returns one of four scalar values stored in the instance of an instrument.', syntax: 'ival = readscratch([index])', example: '--8<-- "examples/readscratch.csd"', seeAlso: ['writescratch', 'Miscellaneous opcodes'] }, { name: 'rewindscore', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Rewinds the playback position of the current score performance.', syntax: 'rewindscore()', example: '--8<-- "examples/rewindscore.csd"', seeAlso: ['Sensing and Control: Score control'] }, { name: 'rms', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Determines the root-mean-square amplitude of an audio signal.', syntax: 'kres = rms(asig [, ihp] [, iskip])', example: '--8<-- "examples/rms.csd"', rates: ['a-rate', 'k-rate'], parameters: [ { name: 'asig', description: 'input audio signal', type: 'performance' }, { name: 'kres', description: 'low-pass filtered rms value of the input signal', type: 'performance' }, ], seeAlso: ['Sensing and Control: Envelope followers'] }, { name: 'sense', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Same as the [sensekey](../opcodes/sensekey.md) opcode.', }, { name: 'sensekey', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Returns the ASCII code of a key that has been pressed, or -1 if no key has been pressed.', syntax: 'kres [, kkeydown] = sensekey()', example: '--8<-- "examples/sensekey.csd"', rates: ['k-rate'], parameters: [ { name: 'kres', description: 'returns the ASCII value of a key which is pressed or released.', type: 'performance' }, { name: 'kkeydown', description: 'returns 1 if the key was pressed, 0 if it was released or if there is no key event.', type: 'performance' }, ], seeAlso: ['Sensing and Control: Keyboard and mouse sensing'] }, { name: 'seqtime', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Generates a trigger signal according to the values stored in a table.', syntax: 'ktrig_out = seqtime(ktime_unit, kstart, kloop, kinitndx, kfn_times)', example: '--8<-- "examples/seqtime.csd"', parameters: [ { name: 'ktrig_out', description: 'output trigger signal', type: 'performance' }, { name: 'ktime_unit', description: 'unit of measure of time, related to seconds.', type: 'performance' }, { name: 'kstart', description: 'start index of looped section', type: 'performance' }, { name: 'kloop', description: 'end index of looped section', type: 'performance' }, { name: 'kinitndx', description: 'initial index', type: 'performance' }, { name: 'kfn_times', description: 'number of table containing a sequence of times', type: 'performance' }, ], seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, { name: 'seqtime2', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Generates a trigger signal according to the values stored in a table.', syntax: 'ktrig_out = seqtime2(ktrig_in, ktime_unit, kstart, kloop, kinitndx, kfn_times)', example: '--8<-- "examples/seqtime2.csd"', parameters: [ { name: 'ktrig_out', description: 'output trigger signal', type: 'performance' }, { name: 'ktime_unit', description: 'unit of measure of time, related to seconds.', type: 'performance' }, { name: 'ktrig_in', description: 'input trigger signal.', type: 'performance' }, { name: 'kstart', description: 'start index of looped section', type: 'performance' }, { name: 'kloop', description: 'end index of looped section', type: 'performance' }, { name: 'kinitndx', description: 'initial index', type: 'performance' }, { name: 'kfn_times', description: 'number of table containing a sequence of times', type: 'performance' }, ], seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, { name: 'sequ', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Emulate a hardware sequencer.', syntax: 'kres = sequ(irhythm[], iinstr[], idata[], kbpm, klen [, kmode] [, kstep] \\\n [, kreset] [, kverbose])\n kres = sequ(irhythm[], iinstr[], idata[][], kbpm, klen [, kmode] [, kstep] \\\n [, kreset] [, kverbose])', example: '--8<-- "examples/sequ1.csd"', rates: ['k-rate'], parameters: [ { name: 'irhythm', description: 'array of durations in beats. The actual duration is determined by these values divided by the current BPM.', type: 'initialization' }, { name: 'iinstr', description: 'array of instrument numbers scheduled per step. An instrument number zero does nothing. It skips the note associated with the step and produces a silence for that note\'s duration.', type: 'initialization' }, { name: 'idata', description: 'Either a vector of p4 values to the associated iinstr step or a two dimensional array of p4, p5, p6...values. Typically, one would specify pitch information in cps, or MIDI note number; but the arbitrary list of p4 data values could have other uses in the called iinstr.', type: 'initialization' }, { name: 'kbpm', description: 'speed of looping in beats per minute.', type: 'performance' }, { name: 'klen', description: 'length of the active part of the sequence (starting from step 0).', type: 'performance' }, { name: 'kmode', description: 'control the sequencer playback. A value of 0 (default) loops forward through the sequence, calling the associated instrument on each step. Other modes are supported. (See below).', type: 'performance' }, { name: 'kstep', description: 'if non zero replace the irhythm array with k-rate triggers. These could be from a MIDI keyboard or any other krate controller. An event is scheduled if this argument is positive, and just waits if it is negative. Default is zero.', type: 'performance' }, { name: 'kreset', description: 'if non zero resets the sequencer (like mode -7). Default is zero.', type: 'performance' }, { name: 'kverbose', description: 'if non zero prints messages about the internal state changes. Default is zero.', type: 'performance' }, { name: 'kres', description: 'gives the index of the event created for the current k-cycle, or -1 if no event happened.', type: 'performance' }, ], seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, { name: 'setctrl', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Configurable slider controls for realtime user input.', syntax: 'setctrl(inum, ival, itype)', example: '--8<-- "examples/setctrl.csd"', parameters: [ { name: 'inum', description: 'number of the slider to set', type: 'initialization' }, { name: 'ival', description: 'value to be sent to the slider', type: 'initialization' }, { name: 'itype', description: 'type of value sent to the slider as follows:', type: 'initialization' }, ], seeAlso: ['Sensing and Control: TCL/TK widgets'] }, { name: 'setscorepos', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Sets the playback position of the current score performance to a given position.', syntax: 'setscorepos(ipos)', example: '--8<-- "examples/setscorepos.csd"', parameters: [ { name: 'ipos', description: 'playback position in seconds.', type: 'initialization' }, ], seeAlso: ['Sensing and Control: Score control'] }, { name: 'splitrig', type: 'opcode', category: 'Instrument Control:Sensing and Control', description: 'Split a trigger signal (i.e. a timed sequence of control-rate impulses) into several channels following a structure designed by the user.', syntax: 'splitrig(ktrig, kndx, imaxtics, ifn, kout1 [,kout2,...,koutN])', example: '--8<-- "examples/splitrig.csd"', rates: ['i-rate'], parameters: [ { name: 'imaxtics', description: 'number of tics belonging to largest pattern', type: 'initialization' }, { name: 'ifn', description: 'number of table containing channel-data structuring', type: 'initialization' }, { name: 'asig', description: 'incoming (input) signal', type: 'performance' }, { name: 'ktrig', description: 'trigger signal', type: 'performance' }, ], seeAlso: ['Sensing and Control: Tempo and Sequencing'] }, ]