chebyshevpoly
Efficiently evaluates the sum of Chebyshev polynomials of arbitrary order.
The chebyshevpoly 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, kn, so that the opcode is calculating a sum of any number of terms in the form kn*Tn(x). Thus, the chebyshevpoly opcode allows for the waveshaping of an audio signal with a dynamic transfer function that gives precise control over the harmonic content of the output.
Syntax
Performance
ain -- the input signal used as the independent variable of the Chebyshev polynomials ("x").
aout -- the output signal ("y").
k0, k1, k2, ... -- k-rate multipliers for each Chebyshev polynomial.
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.
By directly calculating the Chebyshev polynomials, the chebyshevpoly 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 kn coefficient directly controls the amplitude of the nth harmonic partial if the input ain is a sine wave with amplitude = 1.0. This makes chebyshevpoly 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.
If we consider the input parameter ain to be "x" and the output aout to be "y", then the chebyshevpoly opcode calculates the following equation:
where the Tn(x) are defined by the recurrence relation
More information about Chebyshev polynomials can be found on Wikipedia at http://en.wikipedia.org/wiki/Chebyshev_polynomial
Examples
Here is an example of the chebyshevpoly opcode. It uses the file chebyshevpoly.csd.
See also
Opcode Equivalents of Functions
Credits
Author: Anthony Kozar
January 2008
New in Csound version 5.08