Debian Codegraph @

opcodes/websocket.xml

raw symbols SCIP
1
2 <refentry id="websocket">
3 <indexterm id="IndexWebsocket"><primary>websocket</primary></indexterm>
4 <refentryinfo><title>Signal I/O:File I/O</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>websocket</refentrytitle>
7 </refmeta>
8
9 <refnamediv>
10 <refname>websocket</refname>
11 <refpurpose>
12 Read and write signals and arrays using a websocket connection.
13 </refpurpose>
14 </refnamediv>
15
16 <refsect1>
17 <title>Description</title>
18 <para>Plugin opcode in websocketIO. This opcode is part of the plugin repository and has to be installed separately.
19 The plugin repository can be found here: <ulink url="https://github.com/csound/plugins"><citetitle>https://github.com/csound/plugins</citetitle></ulink></para>
20 <para>
21 <emphasis>websocket</emphasis> reads and writes <emphasis>N</emphasis> signals and arrays using a websocket connection.
22 </para>
23 </refsect1>
24
25 <refsect1>
26 <title>Syntax</title>
27 <synopsis>xout1[, xout2, xout3, ..., xoutN] <command>websocket</command> iport, xin</synopsis>
28
29 </refsect1>
30
31 <refsect1>
32 <title>Initialization</title>
33 <para>
34 <emphasis>iport</emphasis> the local web port to read/write data.
35 </para>
36 </refsect1>
37
38 <refsect1>
39 <title>Performance</title>
40 <para>
41 <emphasis>xout1,... xoutN</emphasis> -- The output variables
42 which contain data received from a websocket. On the web side
43 the websocket must send data using a protocol name that matches
44 the output variable name e.g. "ksignal" for a k-rate
45 variable. If an array is intended to be received from a
46 websocket it must be first initialised before being used as an
47 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.
48 </para>
49 <para>
50 <emphasis>xin</emphasis> -- The input variable
51 which contains data to be sent to a websocket. On the web
52 side the websocket receives data using a protocol name that
53 matches the input variable name e.g. "ksignal" for a k-rate
54 variable. When receiving data from a websocket on the web page
55 it must be read as a 32 or 64 bit array, depending on the
56 build of Csound that is being used. <note>The total number of
57 input and output arguments is limited to 20.</note>
58 </para>
59
60 <title>Data Formatting</title>
61 <para>
62 A-rate variables must be send and received as arrays that are <emphasis>ksmps</emphasis> samples large. A-rate arrays similarly are sent and received as <emphasis>ksmps</emphasis> 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.
63 </para>
64 </refsect1>
65
66 <refsect1>
67 <title>Examples</title>
68 <para>
69 Here is a simple example of the websocket opcode. It uses the file <ulink url="examples/websocket.csd"><citetitle>websocket.csd</citetitle></ulink> and <ulink url="examples/websocket.html"><citetitle>websocket.html</citetitle></ulink>.
70
71 <example>
72 <title>Example of the websocket opcode.</title>
73
74 <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para>
75 <xi:include href="examples-xml/websocket.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
76 </example>
77 </para>
78
79 </refsect1>
80
81 <refsect1>
82 <title>See also</title>
83 <para><link linkend="SigioInput"><citetitle>Signal Input</citetitle></link></para>
84 <para><link linkend="SigioOutput"><citetitle>Signal Output</citetitle></link></para>
85 </refsect1>
86
87 <refsect1>
88 <title>Credits</title>
89 <para>
90 <simplelist>
91 <member>Author: Edward Costello;</member>
92 <member>NUIM, 2015</member>
93 </simplelist>
94 </para>
95 <para>New in version 6.06</para>
96 </refsect1>
97 </refentry>