From: dbd on
On Mar 10, 7:26 am, Vladimir Vassilevsky <nos...(a)nowhere.com> wrote:

> ...
> BTW, what could be a procedure of creating a nonlinear function which
> produces the same gross amount of THD on a sine wave regardless of the
> amplitude?
>
> VLV

Wouldn't that be a linear function when "same gross amount of THD" is
specified in dB or percent?

Dale B. Dalrymple
From: robert bristow-johnson on
On Mar 10, 9:52 am, Jerry Avins <j...(a)ieee.org> wrote:
....
> Positive/negative symmetry in a transfer function precludes even
> harmonics, and is a major reason for push-pull (or their totem-pole near
> equivalent) amplifiers. The sound that musicians get by overloading
> their amplifiers has mostly odd harmonics for that reason. I think that
> if you get much even-harmonic distortion, you won't like the sound.

actually, Jerry, i think that they *are* looking for (and getting)
some even-harmonic (particularly 2nd-harmonic) distortion in the old
venerated tube amps. it's the solid-state amps that have been
clipping more symmetrically (and generating only odd harmonics).

distortion created in a guitar amp for musical purposes is a very
difficult thing to emulate and Les won't be able to do it with just a
static, memoryless mapping function. doing this well is a sorta holy
grail in audio. it's why companies like Line 6 are in business.

r b-j
From: robert bristow-johnson on
On Mar 10, 12:51 am, Les Cargill <lcargil...(a)comcast.net> wrote:
> robert bristow-johnson wrote:
> > On Mar 9, 11:30 pm, Jerry Avins <j...(a)ieee.org> wrote:
> >> Les Cargill wrote:
> >>> Mark wrote:
> >>>> On Mar 8, 8:20 pm, Les Cargill <lcargil...(a)comcast.net> wrote:
> >>>>> Jerry Avins wrote:
> >>>>>> Les Cargill wrote:
> >>>>>>> Jerry Avins wrote:
> >>>>>>>> Les Cargill wrote:
> >>>>>>>>> robert bristow-johnson wrote:
> >>>>>>>>   ...
> >>>>>>>>>> are you trying to introduce a specified amount of specific
> >>>>>>>>>> harmonics to a pure sine wave?
> >>>>>>>>> No, for any random PCM stream.
> >>>>>>>> As I see it, the answer is a non-sequitur.
> >>>>>>>>   ...
> >>>>>>>> Jerry
> >>>>>>> How about "for any *arbitrary* PCM stream?"
> >>>>>> That doesn't fix it. I wasn't picking nits. The question was, given any
> >>>>>> arbitrary waveform, what harmonics do you want to add to it.
> >>>>> The usual suspects - second, third, fifth.
> >>>>>> An answer
> >>>>>> pins down a process that applies to any waveform, whether it be random
> >>>>>> or have a familiar name.
> >>>>> Ah! Thanks!
> >>>>>> Jerry
> >>>>> --
> >>>>> Les Cargill
> >>>>>
> >>>> I may be missing something in the discussion but I think the simple
> >>>> answer to your question is:
> >>>> the second harmonic component is created by the A*x^2 term and the the
> >>>> third harmonic component is created by the B*x^3 term etc of the
> >>>> transfer function.   The (complex) magnitude of the coefficents A and
> >>>> B etc determine the magnitude (and phase) of the varous harmonics.
> >>>> Is that what you were asking?
> >>>> Mark
> >>> I believe it is.
> >> But be aware that the x^3 term can affect the amplitude of the
> >> fundamental. I need to think more about the phase.
>
> > i don't think that memoryless mapping functions can do much about
> > phase except maybe flip the polarity.
>
> > now, for Les and Mark. yes, in general, an Nth-order polynomial will
> > create, out of a single sinusoid, new frequencies that are harmonic up
> > to the Nth harmonic.  But the generation of harmonics is level
> > dependent (as it is for any non-linear distortion).
>
> > now, if you *know* or can assume the level of your sinusoid, you can
> > create an Nth-order polynomial that will create a specified level of
> > each harmonic up to the Nth harmonic.  you define your Nth-order
> > polynomial as a sum of Tchebyshev polynomials up to the Nth-order
> > Tchebyshev.  if a normalized sinusoid goes into a 5th-order
> > Tchebyshev, what comes out is only the 5th harmonic and no others.
> > now, does that help you, Les, regarding the "generate harmonic
> > distortion analytically"?
>
> It very much sounds like it does. Yes, the Tchebyshev polynomials
> look like what I'm looking for. Sorry - I should have said as much
> when you brought them up upthread. I am not *sure*, of course - but
> just going over them a bit, I think I see what's up.
>
> Heh. Look here:http://www.ecs.fullerton.edu/~mathews/n2003/chebyshevpoly/ChebyshevPo...
>
> That's exactly what I was thinking of, right there, I bet.
>
> > otherwise, i think you need to be more specific about the nature of
> > your input signal.
>
> Just garden varieties of audio. Nothing fancy. Music, basically.

but different audio signals will generate different harmonics given
the same non-linear mapping function because of intermodulation
distortion. that's why, just to get a base idea what we're talking
about (and a common terminology) when we refer to even/odd harmonic
distortion, we usually mean that to apply to a sinusoid, even if the
normal operation is that a guitar or some other signal goes in.

Les, about that paper you found, the key property is Property 4. In
fact, long ago when i was teaching the joys of Tchebyshev polynomials,
i usually start out with that as a *definition*:


{ cos(n * arccos(x)) -1 <= x <=1
{
T[n](x) = { cosh(n * arccosh(x)) 1 <= x
{
{ (-1)^n * cosh(n * arccosh(-x)) x <= -1


and from that definition, we show first that


T[0](x) = 1

T[1](x) = x

and then the hard part is proving the recursion relationship (Property
1):

T[n+1](x) = 2*x*T[n](x) - T[n-1](x)


from those two initial conditions T0 and T1, and the recursion
relationship, you can see that every T[n](x) is an nth-order
polynomial in x.

anyway, it's the trig definition that will send your cos(w*t) to
cos(n*w*t), and you can sum up weighted Tchebyshev polynomials to send
your cos(w*t) to *any* finite sum of harmonics, *but* it works only
for a *normalized* sinusoidal input. when your input level is
reduced, then your harmonic levels also change and not just
proportionately.

but if you wanted to design a polynomial that would give you a
specified set of harmonics coming out, when a single sinusoid (of a
specific amplitude, A) is going in, that polynomial is:

N
p(x) = SUM{ a[n] * T[n](x/A) }
n=0

when silence (x=0) goes in, if you want zero coming out, then you want


N/2
a[0] = -SUM{ (-1)^m * a[2*m] }
m=1


remember T[0](x) = 1 so the a[0] term is just a DC offset constant,
that you want to set correctly.

and, if you want your low-level behavior to be close to a wire with no
gain change, then you want


(N-1)/2
a[1] = SUM{ (-1)^m * (2*m+1) * a[2*m+1] }
m=1


apply the floor() function to the N/2 and (N-1)/2 upper limits.

this is what i have in my old notes about how to quickly whip up a
polynomial that gives you just exactly the harmonics you want when a
sinusoid of amplitude A goes in. if the input is


x(t) = A*cos(w*t)


then what comes out is


N
p( x(t) ) = SUM{ a[n] * T[n]( cos(w*t) ) }
n=0



N
= SUM{ a[n] * cos(n*w*t)) }
n=0


with the exception of not being able to tweak the phase (but you *can*
flip polarity), this can give you whatever finite Fourier series you
want, coming out.

i'd be happy if someone checked the math on this. i am just
regurgitating. for some reason, i think that a[1] = A (it seems
obvious) but i can't get my a[1] formula above to say the same thing.
Clay or Jerry or Rune or Eric or Dale or anyone, can you tell me what
i am missing?

r b-j
From: Les Cargill on
robert bristow-johnson wrote:
> On Mar 10, 9:52 am, Jerry Avins <j...(a)ieee.org> wrote:
> ...
>> Positive/negative symmetry in a transfer function precludes even
>> harmonics, and is a major reason for push-pull (or their totem-pole near
>> equivalent) amplifiers. The sound that musicians get by overloading
>> their amplifiers has mostly odd harmonics for that reason. I think that
>> if you get much even-harmonic distortion, you won't like the sound.
>
> actually, Jerry, i think that they *are* looking for (and getting)
> some even-harmonic (particularly 2nd-harmonic) distortion in the old
> venerated tube amps.

Yes. Nelson Pass goes on about this at length.

But you get a phase shift for even order harmonics
from using Chebyshev polynomials. I don't remember
if it alternates between 0 and 90 or walks all four poles...
might be the latter.

> it's the solid-state amps that have been
> clipping more symmetrically (and generating only odd harmonics).
>

That is consistent with my understanding.

> distortion created in a guitar amp for musical purposes is a very
> difficult thing to emulate and Les won't be able to do it with just a
> static, memoryless mapping function.

you can't even do it with one distortion technology. It'd
take multiple in a ... networked model, with flows between
elements.

> doing this well is a sorta holy
> grail in audio. it's why companies like Line 6 are in business.
>

Absolutely. I'm not necessarily trying to replace a guitar
amp - this is just messing around. Line6 is a *well managed*,
incumbent company - the products may or may not be the best. The MI
business is very strange. They got there first. I have
a Fender modeller, and it's much easier on the ears.

I even have a VST plugin modeller that somebody just gave up
trying to market and started giving away. It's not a commercially
viable enterprise *at all*. If it was, I wouldn't be asking
on Usenet.

This is as much about "so that's what 2nd harmonic distortion
sounds like" as anything else.

If you're VST capable, some guy outta Cal Arts is giving this
away:
http://www.kvraudio.com/get/2367.html

> r b-j

--
Les Cargill
From: robert bristow-johnson on
On Mar 10, 6:05 pm, Les Cargill <lcargil...(a)comcast.net> wrote:
> Jerry Avins wrote:
>
....
> > Positive/negative symmetry in a transfer function precludes even
> > harmonics,

i would say that even symmetry causes even harmonics and odd symmetry
generates only odd harmonics.

not sure what you meant, Jerry, by positive/negative symmetry. (as
opposed to "same sign"? okay, you meant odd.)


> I am mostly experimenting. And rather than buy parts and
> assembling circuits, for some reason trying to do it DSP seemed
> appealing.
>
> I may also wander off and try the DFT approach.

i wouldn't recommend it.


On Mar 10, 6:06 pm, Les Cargill <lcargil...(a)comcast.net> wrote:
>
> I also found that if you run a long enough string of 'em,
> they generate a sync pulse. Talk about generating an
> identity the hard way...

do you mean

{ 1/N for 1<=n<=N
a[n] = {
{ 0 otherwise?

and then you input

x(t) = (A-1)/2 + ((A+1/2)*cos(w0*t) ?

let A >= 1.

that's what you mean?

r b-j