| 1 | |
| 2 | <refentry id="logbtwo"> |
| 3 | <indexterm id="IndexLogbtwo"><primary>logbtwo</primary></indexterm> |
| 4 | <refentryinfo><title>Mathematical Operations:Mathematical Functions</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>logbtwo</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>logbtwo</refname> |
| 13 | |
| 14 | <refpurpose> |
| 15 | Performs a logarithmic base two calculation. |
| 16 | </refpurpose> |
| 17 | </refnamediv> |
| 18 | |
| 19 | <refsect1> |
| 20 | <title>Description</title> |
| 21 | <para> |
| 22 | Performs a logarithmic base two calculation. |
| 23 | </para> |
| 24 | </refsect1> |
| 25 | |
| 26 | <refsect1> |
| 27 | <title>Syntax</title> |
| 28 | <synopsis><command>logbtwo</command>(x) (init-rate or control-rate args only)</synopsis> |
| 29 | </refsect1> |
| 30 | |
| 31 | <refsect1> |
| 32 | <title>Performance</title> |
| 33 | <para> |
| 34 | <emphasis>logbtwo</emphasis>() returns the logarithm base two of <emphasis>x</emphasis>. The range of values admitted as argument is .25 to 4 (i.e. from -2 octave to +2 octave response). This function is the inverse of <emphasis>powoftwo</emphasis>(). |
| 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 logbtwo opcode. It uses the file <ulink url="examples/logbtwo.csd"><citetitle>logbtwo.csd</citetitle></ulink>. |
| 46 | |
| 47 | <example> |
| 48 | <title>Example of the logbtwo opcode.</title> |
| 49 | |
| 50 | |
| 51 | |
| 52 | <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> |
| 53 | <xi:include href="examples-xml/logbtwo.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 54 | </example> |
| 55 | |
| 56 | Its output should include a line like this: |
| 57 | <screen>instr 1: i1 = 1.585</screen> |
| 58 | </para> |
| 59 | </refsect1> |
| 60 | |
| 61 | <refsect1> |
| 62 | <title>See also</title> |
| 63 | <para><link linkend="MathMatfunc"><citetitle>Mathematical Functions</citetitle></link></para> |
| 64 | </refsect1> |
| 65 | |
| 66 | <refsect1> |
| 67 | <title>Credits</title> |
| 68 | <para> |
| 69 | <simplelist> |
| 70 | <member>Author: &namegabriel;</member> |
| 71 | <member>Italy</member> |
| 72 | <member>June 1998</member> |
| 73 | </simplelist> |
| 74 | </para> |
| 75 | |
| 76 | <para> |
| 77 | <simplelist> |
| 78 | <member>Author: &namejohn;</member> |
| 79 | <member>University of Bath, Codemist, Ltd.</member> |
| 80 | <member>Bath, UK</member> |
| 81 | <member>July 1999</member> |
| 82 | </simplelist> |
| 83 | </para> |
| 84 | <para>Example written by &namekevin;.</para> |
| 85 | |
| 86 | <para>New in Csound version 3.57</para> |
| 87 | </refsect1> |
| 88 | </refentry> |