# [LAD] Harmonic generator and transfer function

fons at kokkinizita.net fons at kokkinizita.net
Wed Dec 1 12:00:49 UTC 2010

```On Wed, Dec 01, 2010 at 01:16:07PM +0300, Andrew Gaydenko wrote:

> I need just
>
> Vout = Vin(a0 + a1*Vin + a2*Vin^2 + ... + aN*Vin^N)
>
> for given a0,..aN with limited N (a1..aN abs will be < 0.1). Say, we just
> recalculat samples' amplitudes directly. Is there any caveats in such direct
> transforming? And why do I need to use another (Chebyshev polynomials) way?

If that is what you need it's simple enough to compute...

But it won't give you a_1 second harmonic distortion, a_2 third
etc (although for small values of 'a_i' you could get near).
The Chebyshev way allows you to control each harmonic independently
(provided the input is a sine).

This is because for the n-th Chebyshev polynomial T_n ()

T_n (cos (x)) = cos (n * x)

The polynomials are very easy to compute using recursion:

T_0(x) = 1
T_1(x) = x
T_N(x) = 2 * x * T_{N-1}(x) - T_{N-2}(x)

etc.

This is simple enough to do directly on the signal, no need
to compute the explicit polynomials.

> Will I get HF hum? Please, direct my nose to an approriate reading! :-)

You will get aliasing if you try to generate anything above Fs/2.

Ciao,

--
FA

There are three of them, and Alleline.

```