Debian Codegraph @

opcodes/pvsbufread.xml

raw symbols SCIP
1
2 <refentry id="pvsbufread">
3 <indexterm id="Indexpvsbufread"><primary>pvsbufread</primary></indexterm>
4
5 <refentryinfo><title>Spectral Processing:Streaming</title></refentryinfo>
6 <refmeta>
7 <refentrytitle>pvsbufread</refentrytitle>
8 </refmeta>
9 <refnamediv>
10 <refname>pvsbufread</refname>
11 <refpurpose>
12 This opcode reads a circular buffer of f-signals (streaming PV signals).
13 </refpurpose>
14 </refnamediv>
15
16 <refsect1>
17 <title>Description</title>
18 <para>
19 This opcode reads from a circular buffer of length ilen (secs),
20 taking a handle for the buffer and a time pointer, which holds the
21 current read position (also in seconds). It is used in conjunction with a
22 <emphasis>pvsbuffer</emphasis> opocde.
23 Reading is circular, wrapping around at the end of the buffer.
24 </para>
25 </refsect1>
26
27 <refsect1>
28 <title>Syntax</title>
29 <synopsis>fsig <command>pvsbufread</command> ktime, khandle[, ilo, ihi, iclear] </synopsis>
30 </refsect1>
31
32 <refsect1>
33 <title>Initialisation</title>
34 <para>
35 <emphasis>ilo, ihi</emphasis> -- set the lowest and highest freqs to be read from the buffer (defaults to 0, Nyquist).
36 </para>
37 <para>
38 <emphasis>iclear</emphasis> -- set to 1 to clear output fsig before every write (default 1), 0 tells the opcode not to clear
39 the output fsig. This is relevant when writing to subsets of an fsig frame using <emphasis>ilo</emphasis>, <emphasis>ihi</emphasis>.
40 </para>
41 </refsect1>
42
43 <refsect1>
44 <title>Performance</title>
45 <para>
46 <emphasis>fsig</emphasis> -- output pv stream
47 </para>
48 <para>
49 <emphasis>ktime</emphasis> -- time position of reading pointer (in secs).
50 </para>
51 <para>
52 <emphasis>khandle</emphasis> -- handle identifying the buffer to be read. When using k-rate
53 handles, it is important to initialise the k-rate variable to a given existing handle. When changing
54 buffers, fsig buffers need to be compatible (same fsig format).
55 </para>
56 <para>
57 With this opcode and <link linkend="pvsbuffer"><citetitle>pvsbuffer</citetitle></link>, it is possible to, among other things:
58 <itemizedlist>
59 <listitem><simpara>time-stretch/compress a fsig stream, by reading it at
60 different rates</simpara></listitem>
61 <listitem><simpara>delay a fsig or portions of it.</simpara></listitem>
62 <listitem><simpara>'brassage' two or more fsigs by switching buffers, since
63 the reading handles are k-rate. Note that, when using k-rate
64 handles, it is important to initialise the k-rate variable to a
65 given handle (so that the fsig initialisation can take place)
66 and it is only possible to switch handles between compatible
67 fsig buffers (with the same fftsize and overlap).</simpara></listitem>
68 </itemizedlist>
69 </para>
70 <note>
71 <para>It is important that the handle value passed to <emphasis>pvsbufread</emphasis> is valid and was created by <link linkend="pvsbuffer"><citetitle>pvsbuffer</citetitle></link>. Csound will crash with invalid handles.
72 </para>
73 </note>
74 </refsect1>
75
76 <refsect1>
77 <title>Examples</title>
78 <para>
79 Here is an example of the pvsbufread opcode. It does 'brassage' by switching between two buffers.
80 <example>
81 <title>Example of the pvsbufread opcode</title>
82 <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>
83
84 <programlisting>
85 fsig1 <emphasis role="opc">pvsanal</emphasis> asig1, 1024, 256, 1024, 1
86 fsig2 <emphasis role="opc">pvsanal</emphasis> asig2, 1024, 256, 1024, 1
87
88
89 ibuf1, kt1 <emphasis role="opc">pvsbuffer</emphasis> fsig1, 10 <emphasis role="comment">; 10-sec buf with fsig1</emphasis>
90 ibuf2, kt2 <emphasis role="opc">pvsbuffer</emphasis> fsig2, 7 <emphasis role="comment">; 7-sec buf with fsig2</emphasis>
91
92 khan <emphasis role="opc">init</emphasis> ibuf1 <emphasis role="comment">; initialise handle to buf1</emphasis>
93
94 <emphasis role="opc">if</emphasis> ktrig <emphasis role="op">&gt;</emphasis> 0 <emphasis role="opc">then</emphasis> <emphasis role="comment">; switch buffers according to trigger</emphasis>
95 khan <emphasis role="op">=</emphasis> ibuf2
96 <emphasis role="opc">else</emphasis>
97 khan <emphasis role="op">=</emphasis> ibuf1
98 <emphasis role="opc">endif</emphasis>
99
100 fsb <emphasis role="opc">pvsbufread</emphasis> kt1, khan <emphasis role="comment">; read buffer</emphasis></programlisting>
101 </example>
102 </para>
103 <para>
104 Here is an example of the pvsbufread opcode. It uses the file <ulink url="examples/pvsbufread.csd"><citetitle>pvsbufread.csd</citetitle></ulink>.
105 <example>
106 <title>Example of the pvsbufread opcode.</title>
107 <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>
108 <xi:include href="examples-xml/pvsbufread.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
109 </example>
110 </para>
111 </refsect1>
112
113 <refsect1>
114 <title>See also</title>
115 <para><link linkend="SpectralRealTime"><citetitle>Tools for Real-time Spectral Processing (pvs opcodes)</citetitle></link></para>
116 </refsect1>
117
118 <refsect1>
119 <title>Credits</title>
120 <para>
121 <simplelist>
122 <member>Author: &namevictor;</member>
123 <member>July 2007</member>
124 </simplelist>
125 </para>
126 </refsect1>
127 </refentry>
128