| 1 |
# @csound/browser |
| 2 |
[](https://www.npmjs.com/package/@csound/browser) |
| 3 |
[](https://github.com/csound/csound/actions?query=workflow%3Acsound_wasm) |
| 4 |
[](https://github.com/prettier/prettier) |
| 5 |
|
| 6 |
|
| 7 |
## Api Documentation |
| 8 |
|
| 9 |
## Objects |
| 10 |
|
| 11 |
<dl> |
| 12 |
<dt><a href="#CsoundObj">CsoundObj</a> : <code>object</code></dt> |
| 13 |
<dd><p>CsoundObj API.</p> |
| 14 |
</dd> |
| 15 |
</dl> |
| 16 |
|
| 17 |
## Functions |
| 18 |
|
| 19 |
<dl> |
| 20 |
<dt><a href="#Csound">Csound([params])</a> ⇒ <code>Promise.<(CsoundObj|undefined)></code></dt> |
| 21 |
<dd><p>The default entry for @csound/wasm/browser module. |
| 22 |
If loaded successfully, it returns CsoundObj, |
| 23 |
otherwise undefined.</p> |
| 24 |
</dd> |
| 25 |
<dt><a href="#getTable">getTable(tableNum)</a> ⇒ <code>Promise.<(Float64Array|undefined)></code></dt> |
| 26 |
<dd></dd> |
| 27 |
</dl> |
| 28 |
|
| 29 |
## Typedefs |
| 30 |
|
| 31 |
<dl> |
| 32 |
<dt><a href="#CSOUND_PARAMS">CSOUND_PARAMS</a></dt> |
| 33 |
<dd></dd> |
| 34 |
<dt><a href="#CS_MIDIDEVICE">CS_MIDIDEVICE</a></dt> |
| 35 |
<dd></dd> |
| 36 |
</dl> |
| 37 |
|
| 38 |
<a name="CsoundObj"></a> |
| 39 |
|
| 40 |
## CsoundObj : <code>object</code> |
| 41 |
CsoundObj API. |
| 42 |
|
| 43 |
**Kind**: global namespace |
| 44 |
|
| 45 |
* [CsoundObj](#CsoundObj) : <code>object</code> |
| 46 |
* _global_ |
| 47 |
* [getTable(tableNum)](#getTable) ⇒ <code>Promise.<(Float64Array\|undefined)></code> |
| 48 |
* _static_ |
| 49 |
* [.fs](#CsoundObj.fs) : <code>IFs:memfs</code> |
| 50 |
* [.eventNames()](#CsoundObj.eventNames) ⇒ <code>Array.<string></code> |
| 51 |
* [.listenerCount()](#CsoundObj.listenerCount) ⇒ <code>number</code> |
| 52 |
* [.listeners(eventName)](#CsoundObj.listeners) ⇒ <code>Array.<function()></code> |
| 53 |
* [.off(eventName, listener)](#CsoundObj.off) ⇒ <code>external:EventEmitter</code> |
| 54 |
* [.on(eventName, listener)](#CsoundObj.on) ⇒ <code>external:EventEmitter</code> |
| 55 |
* [.addListener(eventName, listener)](#CsoundObj.addListener) ⇒ <code>external:EventEmitter</code> |
| 56 |
* [.once(eventName, listener)](#CsoundObj.once) ⇒ <code>external:EventEmitter</code> |
| 57 |
* [.removeAllListeners(eventName)](#CsoundObj.removeAllListeners) ⇒ <code>external:EventEmitter</code> |
| 58 |
* [.removeListener(eventName, listener)](#CsoundObj.removeListener) ⇒ <code>external:EventEmitter</code> |
| 59 |
* [.getSr()](#CsoundObj.getSr) ⇒ <code>Promise.<number></code> |
| 60 |
* [.getKr()](#CsoundObj.getKr) ⇒ <code>Promise.<number></code> |
| 61 |
* [.getKsmps()](#CsoundObj.getKsmps) ⇒ <code>Promise.<number></code> |
| 62 |
* [.getNchnls()](#CsoundObj.getNchnls) ⇒ <code>Promise.<number></code> |
| 63 |
* [.getNchnlsInput()](#CsoundObj.getNchnlsInput) ⇒ <code>Promise.<number></code> |
| 64 |
* [.get0dBFS()](#CsoundObj.get0dBFS) ⇒ <code>Promise.<number></code> |
| 65 |
* [.getA4()](#CsoundObj.getA4) ⇒ <code>Promise.<number></code> |
| 66 |
* [.getCurrentTimeSamples()](#CsoundObj.getCurrentTimeSamples) ⇒ <code>Promise.<number></code> |
| 67 |
* [.getSizeOfMYFLT()](#CsoundObj.getSizeOfMYFLT) ⇒ <code>Promise.<number></code> |
| 68 |
* [.setOption(option)](#CsoundObj.setOption) ⇒ <code>Promise.<number></code> |
| 69 |
* [.setParams(csoundParams)](#CsoundObj.setParams) ⇒ <code>Promise.<undefined></code> |
| 70 |
* [.getParams()](#CsoundObj.getParams) ⇒ [<code>Promise.<CSOUND\_PARAMS></code>](#CSOUND_PARAMS) |
| 71 |
* [.getDebug()](#CsoundObj.getDebug) ⇒ <code>Promise.<number></code> |
| 72 |
* [.setDebug(debug)](#CsoundObj.setDebug) ⇒ <code>Promise.<undefined></code> |
| 73 |
* [.inputMessage(scoreEvent)](#CsoundObj.inputMessage) ⇒ <code>Promise.<number></code> |
| 74 |
* [.inputMessageAsync(scoreEvent)](#CsoundObj.inputMessageAsync) ⇒ <code>Promise.<number></code> |
| 75 |
* [.getControlChannel(channelName)](#CsoundObj.getControlChannel) ⇒ <code>Promise.<undefined></code> |
| 76 |
* [.setControlChannel(channelName, value)](#CsoundObj.setControlChannel) ⇒ <code>Promise.<undefined></code> |
| 77 |
* [.getStringChannel(channelName)](#CsoundObj.getStringChannel) ⇒ <code>Promise.<undefined></code> |
| 78 |
* [.setStringChannel(channelName, value)](#CsoundObj.setStringChannel) ⇒ <code>Promise.<undefined></code> |
| 79 |
* [.getOutputName()](#CsoundObj.getOutputName) ⇒ <code>Promise.<string></code> |
| 80 |
* [.getInputName()](#CsoundObj.getInputName) ⇒ <code>Promise.<string></code> |
| 81 |
* [.destroy()](#CsoundObj.destroy) ⇒ <code>Promise.<undefined></code> |
| 82 |
* [.getAPIVersion()](#CsoundObj.getAPIVersion) ⇒ <code>Promise.<number></code> |
| 83 |
* [.getVersion()](#CsoundObj.getVersion) ⇒ <code>Promise.<number></code> |
| 84 |
* [.initialize()](#CsoundObj.initialize) ⇒ <code>Promise.<number></code> |
| 85 |
* [.parseOrc(orc)](#CsoundObj.parseOrc) ⇒ <code>Promise.<object></code> |
| 86 |
* [.compileTree(tree)](#CsoundObj.compileTree) ⇒ <code>Promise.<number></code> |
| 87 |
* [.compileOrc(orc)](#CsoundObj.compileOrc) ⇒ <code>Promise.<number></code> |
| 88 |
* [.evalCode(orc)](#CsoundObj.evalCode) ⇒ <code>Promise.<number></code> |
| 89 |
* [.start()](#CsoundObj.start) ⇒ <code>Promise.<number></code> |
| 90 |
* [.compileCsd(path)](#CsoundObj.compileCsd) ⇒ <code>Promise.<number></code> |
| 91 |
* [.compileCsdText(orc)](#CsoundObj.compileCsdText) ⇒ <code>Promise.<number></code> |
| 92 |
* [.perform()](#CsoundObj.perform) ⇒ <code>Promise.<number></code> |
| 93 |
* [.performKsmps()](#CsoundObj.performKsmps) ⇒ <code>Promise.<number></code> |
| 94 |
* [.performBuffer()](#CsoundObj.performBuffer) ⇒ <code>Promise.<number></code> |
| 95 |
* [.stop()](#CsoundObj.stop) ⇒ <code>Promise.<undefined></code> |
| 96 |
* [.cleanup()](#CsoundObj.cleanup) ⇒ <code>Promise.<number></code> |
| 97 |
* [.reset()](#CsoundObj.reset) ⇒ <code>Promise.<number></code> |
| 98 |
* [.getInputBufferSize()](#CsoundObj.getInputBufferSize) ⇒ <code>Promise.<number></code> |
| 99 |
* [.getOutputBufferSize()](#CsoundObj.getOutputBufferSize) ⇒ <code>Promise.<number></code> |
| 100 |
* [.getInputBuffer()](#CsoundObj.getInputBuffer) ⇒ <code>Promise.<number></code> |
| 101 |
* [.getOutputBuffer()](#CsoundObj.getOutputBuffer) ⇒ <code>Promise.<number></code> |
| 102 |
* [.getSpin()](#CsoundObj.getSpin) ⇒ <code>Promise.<number></code> |
| 103 |
* [.getSpout()](#CsoundObj.getSpout) ⇒ <code>Promise.<number></code> |
| 104 |
* [.getMIDIDevList(isOutput)](#CsoundObj.getMIDIDevList) ⇒ [<code>Promise.<CS\_MIDIDEVICE></code>](#CS_MIDIDEVICE) |
| 105 |
* [.getRtMidiName()](#CsoundObj.getRtMidiName) ⇒ <code>Promise.<string></code> |
| 106 |
* [.midiMessage(midi, midi, midi)](#CsoundObj.midiMessage) ⇒ <code>Promise.<void></code> |
| 107 |
* [.isScorePending()](#CsoundObj.isScorePending) ⇒ <code>Promise.<number></code> |
| 108 |
* [.setScorePending(pending)](#CsoundObj.setScorePending) ⇒ <code>Promise.<undefined></code> |
| 109 |
* [.readScore(score)](#CsoundObj.readScore) ⇒ <code>Promise.<undefined></code> |
| 110 |
* [.getScoreTime()](#CsoundObj.getScoreTime) ⇒ <code>Promise.<number></code> |
| 111 |
* [.getScoreOffsetSeconds()](#CsoundObj.getScoreOffsetSeconds) ⇒ <code>Promise.<number></code> |
| 112 |
* [.setScoreOffsetSeconds(time)](#CsoundObj.setScoreOffsetSeconds) ⇒ <code>Promise.<number></code> |
| 113 |
* [.rewindScore()](#CsoundObj.rewindScore) ⇒ <code>Promise.<number></code> |
| 114 |
* [.tableLength(tableNum)](#CsoundObj.tableLength) ⇒ <code>Promise.<number></code> |
| 115 |
* [.tableGet(tableNum, tableIndex)](#CsoundObj.tableGet) ⇒ <code>Promise.<number></code> |
| 116 |
* [.tableSet(tableNum, tableIndex, value)](#CsoundObj.tableSet) ⇒ <code>Promise.<undefined></code> |
| 117 |
* [.tableCopyIn(tableNum, tableIndex, array)](#CsoundObj.tableCopyIn) ⇒ <code>Promise.<undefined></code> |
| 118 |
* [.tableCopyOut(tableNum)](#CsoundObj.tableCopyOut) ⇒ <code>Promise.<(Float64Array\|undefined)></code> |
| 119 |
* [.getTableArgs(tableNum)](#CsoundObj.getTableArgs) ⇒ <code>Promise.<(Float64Array\|undefined)></code> |
| 120 |
* [.isNamedGEN(tableNum)](#CsoundObj.isNamedGEN) ⇒ <code>Promise.<number></code> |
| 121 |
* [.getNamedGEN(tableNum)](#CsoundObj.getNamedGEN) ⇒ <code>Promise.<(string\|undefined)></code> |
| 122 |
|
| 123 |
<a name="getTable"></a> |
| 124 |
|
| 125 |
### CsoundObjgetTable(tableNum) ⇒ <code>Promise.<(Float64Array\|undefined)></code> |
| 126 |
**Kind**: global method of [<code>CsoundObj</code>](#CsoundObj) |
| 127 |
|
| 128 |
| Param | Type | |
| 129 |
| --- | --- | |
| 130 |
| tableNum | <code>string</code> | |
| 131 |
|
| 132 |
<a name="CsoundObj.fs"></a> |
| 133 |
|
| 134 |
### CsoundObj.fs : <code>IFs:memfs</code> |
| 135 |
The in-browser filesystem based on nodejs's |
| 136 |
built-in module "fs" |
| 137 |
|
| 138 |
**Kind**: static property of [<code>CsoundObj</code>](#CsoundObj) |
| 139 |
<a name="CsoundObj.eventNames"></a> |
| 140 |
|
| 141 |
### CsoundObj.eventNames() ⇒ <code>Array.<string></code> |
| 142 |
Returns an array listing the events for which the emitter has registered listeners. |
| 143 |
The values in the array are strings. |
| 144 |
|
| 145 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 146 |
<a name="CsoundObj.listenerCount"></a> |
| 147 |
|
| 148 |
### CsoundObj.listenerCount() ⇒ <code>number</code> |
| 149 |
Returns the number of listeners listening to the event named eventName. |
| 150 |
|
| 151 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 152 |
<a name="CsoundObj.listeners"></a> |
| 153 |
|
| 154 |
### CsoundObj.listeners(eventName) ⇒ <code>Array.<function()></code> |
| 155 |
Returns a copy of the array of listeners for the event named eventName. |
| 156 |
|
| 157 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 158 |
|
| 159 |
| Param | Type | |
| 160 |
| --- | --- | |
| 161 |
| eventName | [<code>PublicEvents</code>](#PublicEvents) | |
| 162 |
|
| 163 |
<a name="CsoundObj.off"></a> |
| 164 |
|
| 165 |
### CsoundObj.off(eventName, listener) ⇒ <code>external:EventEmitter</code> |
| 166 |
Alias for removeListener() |
| 167 |
|
| 168 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 169 |
|
| 170 |
| Param | Type | |
| 171 |
| --- | --- | |
| 172 |
| eventName | [<code>PublicEvents</code>](#PublicEvents) | |
| 173 |
| listener | <code>function</code> | |
| 174 |
|
| 175 |
<a name="CsoundObj.on"></a> |
| 176 |
|
| 177 |
### CsoundObj.on(eventName, listener) ⇒ <code>external:EventEmitter</code> |
| 178 |
Adds the listener function to the end of the listeners array for the event named eventName. |
| 179 |
No checks are made to see if the listener has already been added. |
| 180 |
Multiple calls passing the same combination of eventName and listener |
| 181 |
will result in the listener being added, and called, multiple times. |
| 182 |
|
| 183 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 184 |
|
| 185 |
| Param | Type | |
| 186 |
| --- | --- | |
| 187 |
| eventName | [<code>PublicEvents</code>](#PublicEvents) | |
| 188 |
| listener | <code>function</code> | |
| 189 |
|
| 190 |
<a name="CsoundObj.addListener"></a> |
| 191 |
|
| 192 |
### CsoundObj.addListener(eventName, listener) ⇒ <code>external:EventEmitter</code> |
| 193 |
Alias for "on" |
| 194 |
|
| 195 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 196 |
|
| 197 |
| Param | Type | |
| 198 |
| --- | --- | |
| 199 |
| eventName | [<code>PublicEvents</code>](#PublicEvents) | |
| 200 |
| listener | <code>function</code> | |
| 201 |
|
| 202 |
<a name="CsoundObj.once"></a> |
| 203 |
|
| 204 |
### CsoundObj.once(eventName, listener) ⇒ <code>external:EventEmitter</code> |
| 205 |
Adds a one-time listener function for the event named eventName. |
| 206 |
The next time eventName is triggered, this listener is removed and then invoked. |
| 207 |
|
| 208 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 209 |
|
| 210 |
| Param | Type | |
| 211 |
| --- | --- | |
| 212 |
| eventName | [<code>PublicEvents</code>](#PublicEvents) | |
| 213 |
| listener | <code>function</code> | |
| 214 |
|
| 215 |
<a name="CsoundObj.removeAllListeners"></a> |
| 216 |
|
| 217 |
### CsoundObj.removeAllListeners(eventName) ⇒ <code>external:EventEmitter</code> |
| 218 |
Removes all listeners, or those of the specified eventName. |
| 219 |
It is bad practice to remove listeners added elsewhere in the code, |
| 220 |
particularly when the EventEmitter instance was created by some other |
| 221 |
component or module. |
| 222 |
Returns a reference to the EventEmitter, so that calls can be chained. |
| 223 |
|
| 224 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 225 |
|
| 226 |
| Param | Type | |
| 227 |
| --- | --- | |
| 228 |
| eventName | [<code>PublicEvents</code>](#PublicEvents) | |
| 229 |
|
| 230 |
<a name="CsoundObj.removeListener"></a> |
| 231 |
|
| 232 |
### CsoundObj.removeListener(eventName, listener) ⇒ <code>external:EventEmitter</code> |
| 233 |
Removes the specified listener from the listener array for the event named eventName. |
| 234 |
removeListener() will remove, at most, one instance of a listener from the listener array. |
| 235 |
If any single listener has been added multiple times to the listener array for the specified eventName, |
| 236 |
then removeListener() must be called multiple times to remove each instance. |
| 237 |
Removes the specified listener from the listener array for the event named eventName. |
| 238 |
|
| 239 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 240 |
|
| 241 |
| Param | Type | |
| 242 |
| --- | --- | |
| 243 |
| eventName | [<code>PublicEvents</code>](#PublicEvents) | |
| 244 |
| listener | <code>function</code> | |
| 245 |
|
| 246 |
<a name="CsoundObj.getSr"></a> |
| 247 |
|
| 248 |
### CsoundObj.getSr() ⇒ <code>Promise.<number></code> |
| 249 |
Returns the sample rate from Csound instance |
| 250 |
|
| 251 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 252 |
<a name="CsoundObj.getKr"></a> |
| 253 |
|
| 254 |
### CsoundObj.getKr() ⇒ <code>Promise.<number></code> |
| 255 |
Returns the control rate from Csound instance |
| 256 |
|
| 257 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 258 |
<a name="CsoundObj.getKsmps"></a> |
| 259 |
|
| 260 |
### CsoundObj.getKsmps() ⇒ <code>Promise.<number></code> |
| 261 |
Returns the ksmps value (kr/sr) from Csound instance |
| 262 |
|
| 263 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 264 |
<a name="CsoundObj.getNchnls"></a> |
| 265 |
|
| 266 |
### CsoundObj.getNchnls() ⇒ <code>Promise.<number></code> |
| 267 |
Returns the number of output channels from Csound instance |
| 268 |
|
| 269 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 270 |
<a name="CsoundObj.getNchnlsInput"></a> |
| 271 |
|
| 272 |
### CsoundObj.getNchnlsInput() ⇒ <code>Promise.<number></code> |
| 273 |
Returns the number of input channels from Csound instance |
| 274 |
|
| 275 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 276 |
<a name="CsoundObj.get0dBFS"></a> |
| 277 |
|
| 278 |
### CsoundObj.get0dBFS() ⇒ <code>Promise.<number></code> |
| 279 |
Returns the value of csoundGet0dBFS |
| 280 |
|
| 281 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 282 |
<a name="CsoundObj.getA4"></a> |
| 283 |
|
| 284 |
### CsoundObj.getA4() ⇒ <code>Promise.<number></code> |
| 285 |
Returns the A4 frequency reference |
| 286 |
|
| 287 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 288 |
<a name="CsoundObj.getCurrentTimeSamples"></a> |
| 289 |
|
| 290 |
### CsoundObj.getCurrentTimeSamples() ⇒ <code>Promise.<number></code> |
| 291 |
Return the current performance time in samples |
| 292 |
|
| 293 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 294 |
<a name="CsoundObj.getSizeOfMYFLT"></a> |
| 295 |
|
| 296 |
### CsoundObj.getSizeOfMYFLT() ⇒ <code>Promise.<number></code> |
| 297 |
Return the size of MYFLT in number of bytes |
| 298 |
|
| 299 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 300 |
<a name="CsoundObj.setOption"></a> |
| 301 |
|
| 302 |
### CsoundObj.setOption(option) ⇒ <code>Promise.<number></code> |
| 303 |
Set a single csound option (flag), |
| 304 |
no spaces are allowed in the string. |
| 305 |
|
| 306 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 307 |
|
| 308 |
| Param | Type | |
| 309 |
| --- | --- | |
| 310 |
| option | <code>string</code> | |
| 311 |
|
| 312 |
<a name="CsoundObj.setParams"></a> |
| 313 |
|
| 314 |
### CsoundObj.setParams(csoundParams) ⇒ <code>Promise.<undefined></code> |
| 315 |
Configure Csound with a given set of |
| 316 |
parameters defined in the CSOUND_PARAMS structure. |
| 317 |
These parameters are the part of the OPARMS struct |
| 318 |
that are configurable through command line flags. |
| 319 |
The CSOUND_PARAMS structure can be obtained using |
| 320 |
csoundGetParams(). |
| 321 |
These options should only be changed before |
| 322 |
performance has started. |
| 323 |
|
| 324 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 325 |
|
| 326 |
| Param | Type | Description | |
| 327 |
| --- | --- | --- | |
| 328 |
| csoundParams | [<code>CSOUND\_PARAMS</code>](#CSOUND_PARAMS) | csoundParams object | |
| 329 |
|
| 330 |
<a name="CsoundObj.getParams"></a> |
| 331 |
|
| 332 |
### CsoundObj.getParams() ⇒ [<code>Promise.<CSOUND\_PARAMS></code>](#CSOUND_PARAMS) |
| 333 |
Get the current set of parameters |
| 334 |
from a Csound instance |
| 335 |
in a CSOUND_PARAMS structure. |
| 336 |
|
| 337 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 338 |
**Returns**: [<code>Promise.<CSOUND\_PARAMS></code>](#CSOUND_PARAMS) - - CSOUND_PARAMS object |
| 339 |
<a name="CsoundObj.getDebug"></a> |
| 340 |
|
| 341 |
### CsoundObj.getDebug() ⇒ <code>Promise.<number></code> |
| 342 |
Returns whether Csound is set to print debug messages |
| 343 |
sent through the DebugMsg() internal API function. |
| 344 |
Anything different to 0 means true. |
| 345 |
|
| 346 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 347 |
<a name="CsoundObj.setDebug"></a> |
| 348 |
|
| 349 |
### CsoundObj.setDebug(debug) ⇒ <code>Promise.<undefined></code> |
| 350 |
Return the size of MYFLT in number of bytes |
| 351 |
|
| 352 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 353 |
|
| 354 |
| Param | Type | |
| 355 |
| --- | --- | |
| 356 |
| debug | <code>number</code> | |
| 357 |
|
| 358 |
<a name="CsoundObj.inputMessage"></a> |
| 359 |
|
| 360 |
### CsoundObj.inputMessage(scoreEvent) ⇒ <code>Promise.<number></code> |
| 361 |
Inputs an immediate score event |
| 362 |
without any pre-process parsing |
| 363 |
|
| 364 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 365 |
|
| 366 |
| Param | Type | |
| 367 |
| --- | --- | |
| 368 |
| scoreEvent | <code>string</code> | |
| 369 |
|
| 370 |
<a name="CsoundObj.inputMessageAsync"></a> |
| 371 |
|
| 372 |
### CsoundObj.inputMessageAsync(scoreEvent) ⇒ <code>Promise.<number></code> |
| 373 |
Inputs an immediate score event |
| 374 |
without any pre-process parsing |
| 375 |
|
| 376 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 377 |
|
| 378 |
| Param | Type | |
| 379 |
| --- | --- | |
| 380 |
| scoreEvent | <code>string</code> | |
| 381 |
|
| 382 |
<a name="CsoundObj.getControlChannel"></a> |
| 383 |
|
| 384 |
### CsoundObj.getControlChannel(channelName) ⇒ <code>Promise.<undefined></code> |
| 385 |
Retrieves the value of control channel identified by channelName. |
| 386 |
If the err argument is not NULL, the error (or success) code finding |
| 387 |
or accessing the channel is stored in it. |
| 388 |
|
| 389 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 390 |
|
| 391 |
| Param | Type | |
| 392 |
| --- | --- | |
| 393 |
| channelName | <code>string</code> | |
| 394 |
|
| 395 |
<a name="CsoundObj.setControlChannel"></a> |
| 396 |
|
| 397 |
### CsoundObj.setControlChannel(channelName, value) ⇒ <code>Promise.<undefined></code> |
| 398 |
Sets the value of control channel identified by channelName |
| 399 |
|
| 400 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 401 |
|
| 402 |
| Param | Type | |
| 403 |
| --- | --- | |
| 404 |
| channelName | <code>string</code> | |
| 405 |
| value | <code>number</code> | |
| 406 |
|
| 407 |
<a name="CsoundObj.getStringChannel"></a> |
| 408 |
|
| 409 |
### CsoundObj.getStringChannel(channelName) ⇒ <code>Promise.<undefined></code> |
| 410 |
Retrieves the string channel identified by channelName |
| 411 |
|
| 412 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 413 |
|
| 414 |
| Param | Type | |
| 415 |
| --- | --- | |
| 416 |
| channelName | <code>string</code> | |
| 417 |
|
| 418 |
<a name="CsoundObj.setStringChannel"></a> |
| 419 |
|
| 420 |
### CsoundObj.setStringChannel(channelName, value) ⇒ <code>Promise.<undefined></code> |
| 421 |
Sets the string channel value identified by channelName |
| 422 |
|
| 423 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 424 |
|
| 425 |
| Param | Type | |
| 426 |
| --- | --- | |
| 427 |
| channelName | <code>string</code> | |
| 428 |
| value | <code>string</code> | |
| 429 |
|
| 430 |
<a name="CsoundObj.getOutputName"></a> |
| 431 |
|
| 432 |
### CsoundObj.getOutputName() ⇒ <code>Promise.<string></code> |
| 433 |
Returns the audio output name (-o) |
| 434 |
|
| 435 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 436 |
<a name="CsoundObj.getInputName"></a> |
| 437 |
|
| 438 |
### CsoundObj.getInputName() ⇒ <code>Promise.<string></code> |
| 439 |
Returns the audio input name (-i) |
| 440 |
|
| 441 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 442 |
<a name="CsoundObj.destroy"></a> |
| 443 |
|
| 444 |
### CsoundObj.destroy() ⇒ <code>Promise.<undefined></code> |
| 445 |
Destroys an instance of Csound and frees memory |
| 446 |
|
| 447 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 448 |
<a name="CsoundObj.getAPIVersion"></a> |
| 449 |
|
| 450 |
### CsoundObj.getAPIVersion() ⇒ <code>Promise.<number></code> |
| 451 |
Returns the API version as int |
| 452 |
|
| 453 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 454 |
<a name="CsoundObj.getVersion"></a> |
| 455 |
|
| 456 |
### CsoundObj.getVersion() ⇒ <code>Promise.<number></code> |
| 457 |
Returns the Csound version as int |
| 458 |
|
| 459 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 460 |
<a name="CsoundObj.initialize"></a> |
| 461 |
|
| 462 |
### CsoundObj.initialize() ⇒ <code>Promise.<number></code> |
| 463 |
Initialise Csound with specific flags. |
| 464 |
This function is called internally by csoundCreate(), |
| 465 |
so there is generally no need to use it explicitly |
| 466 |
unless you need to avoid default initilization that |
| 467 |
sets signal handlers and atexit() callbacks. |
| 468 |
|
| 469 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 470 |
**Returns**: <code>Promise.<number></code> - - Return value is zero on success, |
| 471 |
positive if initialisation was done already, and negative on error. |
| 472 |
<a name="CsoundObj.parseOrc"></a> |
| 473 |
|
| 474 |
### CsoundObj.parseOrc(orc) ⇒ <code>Promise.<object></code> |
| 475 |
Parses a csound orchestra string |
| 476 |
|
| 477 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 478 |
|
| 479 |
| Param | Type | |
| 480 |
| --- | --- | |
| 481 |
| orc | <code>string</code> | |
| 482 |
|
| 483 |
<a name="CsoundObj.compileTree"></a> |
| 484 |
|
| 485 |
### CsoundObj.compileTree(tree) ⇒ <code>Promise.<number></code> |
| 486 |
Compiles AST tree |
| 487 |
|
| 488 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 489 |
|
| 490 |
| Param | Type | |
| 491 |
| --- | --- | |
| 492 |
| tree | <code>object</code> | |
| 493 |
|
| 494 |
<a name="CsoundObj.compileOrc"></a> |
| 495 |
|
| 496 |
### CsoundObj.compileOrc(orc) ⇒ <code>Promise.<number></code> |
| 497 |
Compiles a csound orchestra string |
| 498 |
|
| 499 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 500 |
|
| 501 |
| Param | Type | |
| 502 |
| --- | --- | |
| 503 |
| orc | <code>string</code> | |
| 504 |
|
| 505 |
<a name="CsoundObj.evalCode"></a> |
| 506 |
|
| 507 |
### CsoundObj.evalCode(orc) ⇒ <code>Promise.<number></code> |
| 508 |
Compiles a csound orchestra string |
| 509 |
|
| 510 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 511 |
|
| 512 |
| Param | Type | |
| 513 |
| --- | --- | |
| 514 |
| orc | <code>string</code> | |
| 515 |
|
| 516 |
<a name="CsoundObj.start"></a> |
| 517 |
|
| 518 |
### CsoundObj.start() ⇒ <code>Promise.<number></code> |
| 519 |
Prepares Csound for performance |
| 520 |
|
| 521 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 522 |
<a name="CsoundObj.compileCsd"></a> |
| 523 |
|
| 524 |
### CsoundObj.compileCsd(path) ⇒ <code>Promise.<number></code> |
| 525 |
Compiles a Csound input file but does not perform it. |
| 526 |
|
| 527 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 528 |
|
| 529 |
| Param | Type | |
| 530 |
| --- | --- | |
| 531 |
| path | <code>string</code> | |
| 532 |
|
| 533 |
<a name="CsoundObj.compileCsdText"></a> |
| 534 |
|
| 535 |
### CsoundObj.compileCsdText(orc) ⇒ <code>Promise.<number></code> |
| 536 |
Compiles a CSD string but does not perform it. |
| 537 |
|
| 538 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 539 |
|
| 540 |
| Param | Type | |
| 541 |
| --- | --- | |
| 542 |
| orc | <code>string</code> | |
| 543 |
|
| 544 |
<a name="CsoundObj.perform"></a> |
| 545 |
|
| 546 |
### CsoundObj.perform() ⇒ <code>Promise.<number></code> |
| 547 |
Performs(plays) audio until end is reached |
| 548 |
|
| 549 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 550 |
<a name="CsoundObj.performKsmps"></a> |
| 551 |
|
| 552 |
### CsoundObj.performKsmps() ⇒ <code>Promise.<number></code> |
| 553 |
Performs(plays) 1 ksmps worth of sample(s) |
| 554 |
|
| 555 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 556 |
<a name="CsoundObj.performBuffer"></a> |
| 557 |
|
| 558 |
### CsoundObj.performBuffer() ⇒ <code>Promise.<number></code> |
| 559 |
Performs(plays) 1 buffer worth of audio |
| 560 |
|
| 561 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 562 |
<a name="CsoundObj.stop"></a> |
| 563 |
|
| 564 |
### CsoundObj.stop() ⇒ <code>Promise.<undefined></code> |
| 565 |
Stops a csoundPerform |
| 566 |
|
| 567 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 568 |
<a name="CsoundObj.cleanup"></a> |
| 569 |
|
| 570 |
### CsoundObj.cleanup() ⇒ <code>Promise.<number></code> |
| 571 |
Prints information about the end of a performance, |
| 572 |
and closes audio and MIDI devices. |
| 573 |
|
| 574 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 575 |
<a name="CsoundObj.reset"></a> |
| 576 |
|
| 577 |
### CsoundObj.reset() ⇒ <code>Promise.<number></code> |
| 578 |
Prints information about the end of a performance, |
| 579 |
and closes audio and MIDI devices. |
| 580 |
|
| 581 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 582 |
<a name="CsoundObj.getInputBufferSize"></a> |
| 583 |
|
| 584 |
### CsoundObj.getInputBufferSize() ⇒ <code>Promise.<number></code> |
| 585 |
Returns the number of samples in Csound's input buffer. |
| 586 |
|
| 587 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 588 |
<a name="CsoundObj.getOutputBufferSize"></a> |
| 589 |
|
| 590 |
### CsoundObj.getOutputBufferSize() ⇒ <code>Promise.<number></code> |
| 591 |
Returns the number of samples in Csound's output buffer. |
| 592 |
|
| 593 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 594 |
<a name="CsoundObj.getInputBuffer"></a> |
| 595 |
|
| 596 |
### CsoundObj.getInputBuffer() ⇒ <code>Promise.<number></code> |
| 597 |
Returns the address of the Csound audio input buffer. |
| 598 |
|
| 599 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 600 |
<a name="CsoundObj.getOutputBuffer"></a> |
| 601 |
|
| 602 |
### CsoundObj.getOutputBuffer() ⇒ <code>Promise.<number></code> |
| 603 |
Returns the address of the Csound audio output buffer. |
| 604 |
|
| 605 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 606 |
<a name="CsoundObj.getSpin"></a> |
| 607 |
|
| 608 |
### CsoundObj.getSpin() ⇒ <code>Promise.<number></code> |
| 609 |
Returns the address of the Csound audio input working buffer (spin). |
| 610 |
Enables external software to write audio into Csound before calling csoundPerformKsmps. |
| 611 |
|
| 612 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 613 |
<a name="CsoundObj.getSpout"></a> |
| 614 |
|
| 615 |
### CsoundObj.getSpout() ⇒ <code>Promise.<number></code> |
| 616 |
Returns the address of the Csound audio output working buffer (spout). |
| 617 |
Enables external software to read audio from Csound after calling csoundPerformKsmps. |
| 618 |
|
| 619 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 620 |
<a name="CsoundObj.getMIDIDevList"></a> |
| 621 |
|
| 622 |
### CsoundObj.getMIDIDevList(isOutput) ⇒ [<code>Promise.<CS\_MIDIDEVICE></code>](#CS_MIDIDEVICE) |
| 623 |
This function can be called to obtain a list of available input or output midi devices. |
| 624 |
If list is NULL, the function will only return the number of devices |
| 625 |
(isOutput=1 for out devices, 0 for in devices). |
| 626 |
|
| 627 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 628 |
|
| 629 |
| Param | Type | |
| 630 |
| --- | --- | |
| 631 |
| isOutput | <code>number</code> | |
| 632 |
|
| 633 |
<a name="CsoundObj.getRtMidiName"></a> |
| 634 |
|
| 635 |
### CsoundObj.getRtMidiName() ⇒ <code>Promise.<string></code> |
| 636 |
This function can be called to obtain a list of available input or output midi devices. |
| 637 |
If list is NULL, the function will only return the number of devices |
| 638 |
(isOutput=1 for out devices, 0 for in devices). |
| 639 |
|
| 640 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 641 |
<a name="CsoundObj.midiMessage"></a> |
| 642 |
|
| 643 |
### CsoundObj.midiMessage(midi, midi, midi) ⇒ <code>Promise.<void></code> |
| 644 |
Emit a midi message with a given triplet of values |
| 645 |
in the range of 0 to 127. |
| 646 |
|
| 647 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 648 |
|
| 649 |
| Param | Type | Description | |
| 650 |
| --- | --- | --- | |
| 651 |
| midi | <code>number</code> | status value | |
| 652 |
| midi | <code>number</code> | data1 | |
| 653 |
| midi | <code>number</code> | data2 | |
| 654 |
|
| 655 |
<a name="CsoundObj.isScorePending"></a> |
| 656 |
|
| 657 |
### CsoundObj.isScorePending() ⇒ <code>Promise.<number></code> |
| 658 |
Sees whether Csound score events are performed or not, |
| 659 |
independently of real-time MIDI events |
| 660 |
|
| 661 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 662 |
<a name="CsoundObj.setScorePending"></a> |
| 663 |
|
| 664 |
### CsoundObj.setScorePending(pending) ⇒ <code>Promise.<undefined></code> |
| 665 |
Sets whether Csound score events are performed or not |
| 666 |
(real-time events will continue to be performed). |
| 667 |
Can be used by external software, such as a VST host, |
| 668 |
to turn off performance of score events (while continuing to perform real-time events), |
| 669 |
for example to mute a Csound score while working on other tracks of a piece, |
| 670 |
or to play the Csound instruments live. |
| 671 |
|
| 672 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 673 |
|
| 674 |
| Param | Type | |
| 675 |
| --- | --- | |
| 676 |
| pending | <code>number</code> | |
| 677 |
|
| 678 |
<a name="CsoundObj.readScore"></a> |
| 679 |
|
| 680 |
### CsoundObj.readScore(score) ⇒ <code>Promise.<undefined></code> |
| 681 |
Read, preprocess, and load a score from an ASCII string It can be called repeatedly, |
| 682 |
with the new score events being added to the currently scheduled ones. |
| 683 |
|
| 684 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 685 |
|
| 686 |
| Param | Type | |
| 687 |
| --- | --- | |
| 688 |
| score | <code>string</code> | |
| 689 |
|
| 690 |
<a name="CsoundObj.getScoreTime"></a> |
| 691 |
|
| 692 |
### CsoundObj.getScoreTime() ⇒ <code>Promise.<number></code> |
| 693 |
Returns the current score time in seconds since the beginning of performance. |
| 694 |
|
| 695 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 696 |
<a name="CsoundObj.getScoreOffsetSeconds"></a> |
| 697 |
|
| 698 |
### CsoundObj.getScoreOffsetSeconds() ⇒ <code>Promise.<number></code> |
| 699 |
Returns the score time beginning at which score events will actually immediately be performed |
| 700 |
|
| 701 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 702 |
<a name="CsoundObj.setScoreOffsetSeconds"></a> |
| 703 |
|
| 704 |
### CsoundObj.setScoreOffsetSeconds(time) ⇒ <code>Promise.<number></code> |
| 705 |
Csound score events prior to the specified time are not performed, |
| 706 |
and performance begins immediately at the specified time |
| 707 |
(real-time events will continue to be performed as they are received). |
| 708 |
Can be used by external software, such as a VST host, to begin |
| 709 |
score performance midway through a Csound score, |
| 710 |
for example to repeat a loop in a sequencer, |
| 711 |
or to synchronize other events with the Csound score. |
| 712 |
|
| 713 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 714 |
|
| 715 |
| Param | Type | |
| 716 |
| --- | --- | |
| 717 |
| time | <code>number</code> | |
| 718 |
|
| 719 |
<a name="CsoundObj.rewindScore"></a> |
| 720 |
|
| 721 |
### CsoundObj.rewindScore() ⇒ <code>Promise.<number></code> |
| 722 |
Rewinds a compiled Csound score to the time specified with csoundObj.setScoreOffsetSeconds(). |
| 723 |
|
| 724 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 725 |
<a name="CsoundObj.tableLength"></a> |
| 726 |
|
| 727 |
### CsoundObj.tableLength(tableNum) ⇒ <code>Promise.<number></code> |
| 728 |
Returns the length of a function table |
| 729 |
(not including the guard point), |
| 730 |
or -1 if the table does not exist. |
| 731 |
|
| 732 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 733 |
|
| 734 |
| Param | Type | |
| 735 |
| --- | --- | |
| 736 |
| tableNum | <code>string</code> | |
| 737 |
|
| 738 |
<a name="CsoundObj.tableGet"></a> |
| 739 |
|
| 740 |
### CsoundObj.tableGet(tableNum, tableIndex) ⇒ <code>Promise.<number></code> |
| 741 |
Returns the value of a slot in a function table. |
| 742 |
The table number and index are assumed to be valid. |
| 743 |
|
| 744 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 745 |
|
| 746 |
| Param | Type | |
| 747 |
| --- | --- | |
| 748 |
| tableNum | <code>string</code> | |
| 749 |
| tableIndex | <code>string</code> | |
| 750 |
|
| 751 |
<a name="CsoundObj.tableSet"></a> |
| 752 |
|
| 753 |
### CsoundObj.tableSet(tableNum, tableIndex, value) ⇒ <code>Promise.<undefined></code> |
| 754 |
Sets the value of a slot in a function table. |
| 755 |
The table number and index are assumed to be valid. |
| 756 |
|
| 757 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 758 |
|
| 759 |
| Param | Type | |
| 760 |
| --- | --- | |
| 761 |
| tableNum | <code>string</code> | |
| 762 |
| tableIndex | <code>string</code> | |
| 763 |
| value | <code>string</code> | |
| 764 |
|
| 765 |
<a name="CsoundObj.tableCopyIn"></a> |
| 766 |
|
| 767 |
### CsoundObj.tableCopyIn(tableNum, tableIndex, array) ⇒ <code>Promise.<undefined></code> |
| 768 |
Copy the contents of an Array or TypedArray from javascript into a given csound function table. |
| 769 |
The table number is assumed to be valid, and the table needs to have sufficient space |
| 770 |
to receive all the array contents. |
| 771 |
The table number and index are assumed to be valid. |
| 772 |
|
| 773 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 774 |
|
| 775 |
| Param | Type | |
| 776 |
| --- | --- | |
| 777 |
| tableNum | <code>string</code> | |
| 778 |
| tableIndex | <code>string</code> | |
| 779 |
| array | <code>Array.<number></code> \| <code>ArrayLike.<number></code> | |
| 780 |
|
| 781 |
<a name="CsoundObj.tableCopyOut"></a> |
| 782 |
|
| 783 |
### CsoundObj.tableCopyOut(tableNum) ⇒ <code>Promise.<(Float64Array\|undefined)></code> |
| 784 |
Copies the contents of a function table from csound into Float64Array. |
| 785 |
The function returns a Float64Array if the table exists, otherwise |
| 786 |
it returns undefined. |
| 787 |
|
| 788 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 789 |
|
| 790 |
| Param | Type | |
| 791 |
| --- | --- | |
| 792 |
| tableNum | <code>string</code> | |
| 793 |
|
| 794 |
<a name="CsoundObj.getTableArgs"></a> |
| 795 |
|
| 796 |
### CsoundObj.getTableArgs(tableNum) ⇒ <code>Promise.<(Float64Array\|undefined)></code> |
| 797 |
Copies the contents of a function table from csound into Float64Array. |
| 798 |
The function returns a Float64Array if the table exists, otherwise |
| 799 |
it returns undefined. |
| 800 |
|
| 801 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 802 |
|
| 803 |
| Param | Type | |
| 804 |
| --- | --- | |
| 805 |
| tableNum | <code>string</code> | |
| 806 |
|
| 807 |
<a name="CsoundObj.isNamedGEN"></a> |
| 808 |
|
| 809 |
### CsoundObj.isNamedGEN(tableNum) ⇒ <code>Promise.<number></code> |
| 810 |
Checks if a given GEN number num is a named GEN if so, |
| 811 |
it returns the string length (excluding terminating NULL char). |
| 812 |
Otherwise it returns 0. |
| 813 |
|
| 814 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 815 |
|
| 816 |
| Param | Type | |
| 817 |
| --- | --- | |
| 818 |
| tableNum | <code>string</code> | |
| 819 |
|
| 820 |
<a name="CsoundObj.getNamedGEN"></a> |
| 821 |
|
| 822 |
### CsoundObj.getNamedGEN(tableNum) ⇒ <code>Promise.<(string\|undefined)></code> |
| 823 |
Gets the GEN name from a number num, if this is a named GEN. |
| 824 |
If the table number doesn't represent a named GEN, it will |
| 825 |
return undefined. |
| 826 |
|
| 827 |
**Kind**: static method of [<code>CsoundObj</code>](#CsoundObj) |
| 828 |
|
| 829 |
| Param | Type | |
| 830 |
| --- | --- | |
| 831 |
| tableNum | <code>string</code> | |
| 832 |
|
| 833 |
<a name="PublicEvents"></a> |
| 834 |
|
| 835 |
## PublicEvents : <code>enum</code> |
| 836 |
**Kind**: global enum |
| 837 |
**Read only**: true |
| 838 |
**Properties** |
| 839 |
|
| 840 |
| Name | Type | Description | |
| 841 |
| --- | --- | --- | |
| 842 |
| "play" | <code>string</code> | called anytime performance goes from pause/stop to a running state. | |
| 843 |
| "pause" | <code>string</code> | called after any successful csound.pause() calls. | |
| 844 |
| "stop" | <code>string</code> | called after end of performance or after a successful csound.stop(). | |
| 845 |
| "realtimePerformanceStarted" | <code>string</code> | called at the start of realtime performance but not on resume or render. | |
| 846 |
| "realtimePerformancePaused" | <code>string</code> | only called if csound.pause() was successfully called during performance. | |
| 847 |
| "realtimePerformanceResumed" | <code>string</code> | only called if csound.resume() was successfully called after a pause. | |
| 848 |
| "realtimePerformanceEnded" | <code>string</code> | called after end of performance or after a successful csound.stop(). | |
| 849 |
| "renderStarted" | <code>string</code> | called at the start of offline/non-realtime render to disk. | |
| 850 |
| "renderEnded" | <code>string</code> | called at the end of offline/non-realtime render to disk. | |
| 851 |
| "onAudioNodeCreated" | <code>string</code> | called when an audioNode is created from the AudioContext before realtime performance. the event callback will include the audioNode itself, which is needed if autoConnect is set to false. | |
| 852 |
| "message" | <code>string</code> | the main entrypoint to csound's messaging (-m) system, a default event listener will print the message to the browser console, this default listener can be removed by the user. | |
| 853 |
|
| 854 |
<a name="Csound"></a> |
| 855 |
|
| 856 |
## Csound([params]) ⇒ <code>Promise.<(CsoundObj\|undefined)></code> |
| 857 |
The default entry for @csound/wasm/browser module. |
| 858 |
If loaded successfully, it returns CsoundObj, |
| 859 |
otherwise undefined. |
| 860 |
|
| 861 |
**Kind**: global function |
| 862 |
|
| 863 |
| Param | Type | Default | Description | |
| 864 |
| --- | --- | --- | --- | |
| 865 |
| [params] | <code>Object</code> | | Initialization parameters | |
| 866 |
| [params.audioContext] | <code>AudioContext</code> | | Optional AudioContext to use; if none given, an AudioContext will be created. | |
| 867 |
| [params.inputChannelCount] | <code>Number</code> | | Optional input channel count for AudioNode used with WebAudio graph. Defaults to the value of nchnls_i in useWorker but 2 otherwise. | |
| 868 |
| [params.outputChannelCount] | <code>Number</code> | | Optional output channel count AudioNode used with WebAudio graph. Defaults to the value of nchnls in useWorker but 2 otherwise. | |
| 869 |
| [params.autoConnect] | <code>Boolean</code> | <code>true</code> | Set to configure Csound to automatically connect to the audioContext.destination output. | |
| 870 |
| [params.withPlugins] | <code>Array.<Object></code> | | Array of WebAssembly Csound plugin libraries to use with Csound. | |
| 871 |
| [params.useWorker] | <code>Boolean</code> | <code>false</code> | Configure to use backend using Web Workers to run Csound in a thread separate from audio callback. | |
| 872 |
| [params.useSAB] | <code>Boolean</code> | <code>true</code> | Configure to use SharedArrayBuffers for WebWorker communications if platform supports it. | |
| 873 |
| [params.useSPN] | <code>Boolean</code> | <code>false</code> | Configure to use explicitly request ScriptProcessorNode rather than AudioWorklet. Recommended only for debug testing purposes. | |
| 874 |
|
| 875 |
<a name="CSOUND_PARAMS"></a> |
| 876 |
|
| 877 |
## CSOUND\_PARAMS |
| 878 |
**Kind**: global typedef |
| 879 |
**Properties** |
| 880 |
|
| 881 |
| Name | Type | |
| 882 |
| --- | --- | |
| 883 |
| debug_mode | <code>number</code> | |
| 884 |
| buffer_frames | <code>number</code> | |
| 885 |
| hardware_buffer_frames | <code>number</code> | |
| 886 |
| displays | <code>number</code> | |
| 887 |
| ascii_graphs | <code>number</code> | |
| 888 |
| postscript_graphs | <code>number</code> | |
| 889 |
| message_level | <code>number</code> | |
| 890 |
| tempo | <code>number</code> | |
| 891 |
| ring_bell | <code>number</code> | |
| 892 |
| use_cscore | <code>number</code> | |
| 893 |
| terminate_on_midi | <code>number</code> | |
| 894 |
| heartbeat | <code>number</code> | |
| 895 |
| defer_gen01_load | <code>number</code> | |
| 896 |
| midi_key | <code>number</code> | |
| 897 |
| midi_key_cps | <code>number</code> | |
| 898 |
| midi_key_oct | <code>number</code> | |
| 899 |
| midi_key_pch | <code>number</code> | |
| 900 |
| midi_velocity | <code>number</code> | |
| 901 |
|
| 902 |
<a name="CS_MIDIDEVICE"></a> |
| 903 |
|
| 904 |
## CS\_MIDIDEVICE |
| 905 |
**Kind**: global typedef |
| 906 |
**Properties** |
| 907 |
|
| 908 |
| Name | Type | |
| 909 |
| --- | --- | |
| 910 |
| device_name | <code>string</code> | |
| 911 |
| interface_name | <code>string</code> | |
| 912 |
| device_id | <code>string</code> | |
| 913 |
| midi_module | <code>string</code> | |
| 914 |
| isOutput | <code>number</code> | |
| 915 |
|
| 916 |
|