Debian Codegraph @

opcodes/powoftwo.xml

raw symbols SCIP
1
2 <refentry id="powoftwo">
3 <indexterm id="IndexPowoftwo"><primary>powoftwo</primary></indexterm>
4 <refentryinfo><title>Mathematical Operations:Mathematical Functions</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>powoftwo</refentrytitle>
7 </refmeta>
8
9
10
11 <refnamediv>
12 <refname>powoftwo</refname>
13
14 <refpurpose>
15 Performs a power-of-two calculation.
16 </refpurpose>
17 </refnamediv>
18
19 <refsect1>
20 <title>Description</title>
21 <para>
22 Performs a power-of-two calculation.
23 </para>
24 </refsect1>
25
26 <refsect1>
27 <title>Syntax</title>
28 <synopsis><command>powoftwo</command>(x) (init-rate or control-rate args only)</synopsis>
29 </refsect1>
30
31 <refsect1>
32 <title>Performance</title>
33 <para>
34 <emphasis>powoftwo</emphasis>() function returns 2<superscript><emphasis>x</emphasis></superscript> and allows positive and negatives numbers as argument. The range of values admitted in <emphasis>powoftwo</emphasis>() is -5 to +5 allowing a precision more fine than one cent in a range of ten octaves. If a greater range of values is required, use the slower opcode <link linkend="pow"><citetitle>pow</citetitle></link>.
35 </para>
36
37 <para>
38 These functions are fast, because they read values stored in tables. Also they are very useful when working with tuning ratios. They work at i- and k-rate.
39 </para>
40 </refsect1>
41
42 <refsect1>
43 <title>Examples</title>
44 <para>
45 Here is an example of the powoftwo opcode. It uses the file <ulink url="examples/powoftwo.csd"><citetitle>powoftwo.csd</citetitle></ulink>.
46 <example>
47 <title>Example of the powoftwo opcode.</title>
48 <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>
49 <xi:include href="examples-xml/powoftwo.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
50 </example>
51
52 Its output should include a line like this:
53 <screen>
54 instr 1: iQuantize = 32768.000
55 instr 1: iQuantize = 2048.000
56 instr 1: iQuantize = 128.000
57 instr 1: iQuantize = 8.000
58 instr 1: iQuantize = 2.000
59 instr 1: iQuantize = 1.000
60 </screen>
61 </para>
62 </refsect1>
63
64 <refsect1>
65 <title>See also</title>
66 <para><link linkend="MathMatfunc"><citetitle>Mathematical Functions</citetitle></link></para>
67 </refsect1>
68
69 <refsect1>
70 <title>Credits</title>
71 <para>
72 <simplelist>
73 <member>Author: &namegabriel;</member>
74 <member>Italy</member>
75 <member>June 1998</member>
76 </simplelist>
77 </para>
78
79 <para>
80 <simplelist>
81 <member>Author: &namejohn;</member>
82 <member>University of Bath, Codemist, Ltd.</member>
83 <member>Bath, UK</member>
84 <member>July 1999</member>
85 </simplelist>
86 </para>
87 <para>New in Csound version 3.57</para>
88 </refsect1>
89 </refentry>