Debian Codegraph @

opcodes/chebyshevpoly.xml

raw symbols SCIP
1
2 <refentry id="chebyshevpoly">
3 <indexterm id="IndexChebyshevpoly"><primary>chebyshevpoly</primary></indexterm>
4 <refentryinfo><title>Signal Modifiers:Waveshaping</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>chebyshevpoly</refentrytitle>
7 </refmeta>
8
9
10
11 <refnamediv>
12 <refname>chebyshevpoly</refname>
13
14 <refpurpose>
15 Efficiently evaluates the sum of Chebyshev polynomials of arbitrary order.
16 </refpurpose>
17 </refnamediv>
18
19 <refsect1>
20 <title>Description</title>
21 <para>
22 The <emphasis>chebyshevpoly</emphasis> opcode calculates the value of a polynomial expression with a single a-rate input variable that is made up of a linear combination of the first N Chebyshev polynomials of the first kind. Each Chebyshev polynomial, Tn(x), is weighted by a k-rate coefficient, <emphasis>kn</emphasis>, so that the opcode is calculating a sum of any number of terms in the form <emphasis>kn*Tn(x)</emphasis>. Thus, the <emphasis>chebyshevpoly</emphasis> opcode allows for the waveshaping of an audio signal with a <emphasis>dynamic</emphasis> transfer function that gives precise control over the harmonic content of the output.
23 </para>
24 </refsect1>
25
26 <refsect1>
27 <title>Syntax</title>
28 <synopsis>aout <command>chebyshevpoly</command> ain, k0 [, k1 [, k2 [...]]]</synopsis>
29 </refsect1>
30
31 <refsect1>
32 <title>Performance</title>
33 <para>
34 <emphasis>ain</emphasis> -- the input signal used as the independent variable of the Chebyshev polynomials ("x").
35 </para>
36
37 <para>
38 <emphasis>aout</emphasis> -- the output signal ("y").
39 </para>
40
41 <para>
42 <emphasis>k0, k1, k2, ...</emphasis> -- k-rate multipliers for each Chebyshev polynomial.
43 </para>
44
45 <para>
46 This opcode is very useful for dynamic waveshaping of an audio signal. Traditional waveshaping techniques utilize a lookup table for the transfer function -- usually a sum of Chebyshev polynomials. When a sine wave at full-scale amplitude is used as an index to read the table, the precise harmonic spectrum as defined by the weights of the Chebyshev polynomials is produced. A dynamic spectrum is acheived by varying the amplitude of the input sine wave, but this produces a non-linear change in the spectrum.
47 </para>
48
49 <para>
50 By directly calculating the Chebyshev polynomials, the <emphasis>chebyshevpoly</emphasis> opcode allows more control over the spectrum and the number of harmonic partials added to the input can be varied with time. The value of each <emphasis>kn</emphasis> coefficient directly controls the amplitude of the nth harmonic partial if the input <emphasis>ain</emphasis> is a sine wave with amplitude = 1.0. This makes <emphasis>chebyshevpoly</emphasis> an efficient additive synthesis engine for N partials that requires only one oscillator instead of N oscillators. The amplitude or waveform of the input signal can also be changed for different waveshaping effects.
51 </para>
52
53 <para>
54 If we consider the input parameter <emphasis>ain</emphasis> to be "x" and the output <emphasis>aout</emphasis> to be "y", then the <emphasis>chebyshevpoly</emphasis> opcode calculates the following equation:
55 <literallayout>
56 y = k0*T0(x) + k1*T1(x) + k2*T2(x) + k3*T3(x) + ...
57 </literallayout>
58 </para>
59
60 <para>
61 where the Tn(x) are defined by the recurrence relation
62 <literallayout>
63 T0(x) = 1,
64 T1(x) = x,
65 Tn(x) = 2x*T[n-1](x) - T[n-2](x)
66 </literallayout>
67 </para>
68
69 <para>
70 More information about Chebyshev polynomials can be found on Wikipedia at
71 <ulink url="http://en.wikipedia.org/wiki/Chebyshev_polynomial">
72 <citetitle>http://en.wikipedia.org/wiki/Chebyshev_polynomial</citetitle>
73 </ulink>
74 </para>
75 </refsect1>
76
77 <refsect1>
78 <title>Examples</title>
79 <para>
80 Here is an example of the chebyshevpoly opcode. It uses the file <ulink url="examples/chebyshevpoly.csd"><citetitle>chebyshevpoly.csd</citetitle></ulink>.
81 <example>
82 <title>Example of the chebyshevpoly opcode.</title>
83 <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>
84 <xi:include href="examples-xml/chebyshevpoly.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
85 </example>
86 </para>
87 </refsect1>
88
89 <refsect1>
90 <title>See also</title>
91 <para><link linkend="SigmodWavshape"><citetitle>Waveshaping</citetitle></link></para>
92 <para><link linkend="MathOpeqfunc"><citetitle>Opcode Equivalents of Functions</citetitle></link></para>
93 </refsect1>
94
95 <refsect1>
96 <title>Credits</title>
97 <para>
98 <simplelist>
99 <member>Author: &nameanthony;</member>
100 <member>January 2008</member>
101 </simplelist>
102 </para>
103
104 <para>New in Csound version 5.08</para>
105 </refsect1>
106 </refentry>