websocket — Read and write signals and arrays using a websocket connection.
Plugin opcode in websocketIO. This opcode is part of the plugin repository and has to be installed separately. The plugin repository can be found here: https://github.com/csound/plugins
websocket reads and writes N signals and arrays using a websocket connection.
xout1,... xoutN -- The output variables which contain data received from a websocket. On the web side the websocket must send data using a protocol name that matches the output variable name e.g. "ksignal" for a k-rate variable. If an array is intended to be received from a websocket it must be first initialised before being used as an output to the opcode. Otherwise the opcode does not know what size data to expect from the websocket. When sending data to a websocket from the web page it must be sent as a 32 or 64 bit array, depending on the build of Csound that is being used.
xin -- The input variable which contains data to be sent to a websocket. On the web side the websocket receives data using a protocol name that matches the input variable name e.g. "ksignal" for a k-rate variable. When receiving data from a websocket on the web page it must be read as a 32 or 64 bit array, depending on the build of Csound that is being used.
Note | |
---|---|
The total number of input and output arguments is limited to 20. |
A-rate variables must be send and received as arrays that are ksmps samples large. A-rate arrays similarly are sent and received as ksmps by the number of elements in the array. K-rate variables are sent and received as a single element array. K-rate arrays are sent and received as arrays with matching numbers of elements.
Here is a simple example of the websocket opcode. It uses the file websocket.csd and websocket.html.
Example 1202. Example of the websocket opcode.
See the sections Real-time Audio and Command Line Flags for more information on using command line flags.