Path: utzoo!attcan!uunet!ginosko!gem.mps.ohio-state.edu!apple!wass
From: wass@Apple.COM (Steve Wasserman)
Newsgroups: comp.dsp
Subject: Re: Pitch shift / offset and FFT
Message-ID: <4428@internal.Apple.COM>
Date: 28 Sep 89 02:09:05 GMT
References: <4384@internal.Apple.COM> <89264.171306P85025@BARILVM.BITNET> <9520001@hpsad.HP.COM> <1787@draken.nada.kth.se> <4725@orca.WV.TEK.COM>
Organization: Apple Computer Inc, Cupertino, CA
Lines: 79

In article <4725@orca.WV.TEK.COM> mhorne@ka7axd.wv.tek.com writes:
>> them, you will not get a 100 Hz harmonic, but rather the two
>> frequencies will BEAT together at 100 Hz.  The perceived effect (in
>> sound, at least) is a 1050 Hz signal that rapidly gets changes volume.
... stuff deleted ...
>
>two sinusoids added together.  Nothing magical happens; Any perceived beating
>between the two (or more) sinusoids, such as what your ear hears, is caused
>by the mixing (multiplying) action of the ear itself (with a little help from
>the brain:).  Understanding this gives you a good feel for how subjective 
>music really is.

In the original posting, I forgot to say that I was assuming that the
two sinusoids in my example had the same magnitude.  I disagree with
you slightly - beating is *not* caused by your ears and brain, it
really happens.

Think of it this way: Imagine two vectors of unit length at the
origin.  At time t=0, they both point in the theta = 0 direction.  One
rotates around the origin 1000 times a second and the other
1100 times per second.  If you add these vectors and take the real
part of the result, you get the waveform created by mixing 1000 Hz and
1100 Hz.

Now change your perspective a little bit.  Imagine this whole
arrangement (or yourself, if you prefer) spinning at 1050 Hz.
Relative to the new frame of reference, one vector is spinning at +50
Hz and the other is spinning at -50 Hz.  Adding these two gives a
vector that always points in the theta = 0 direction (i.e. it is
always midway between the two) and whose magnitude varies between -2
and 2 at a rate of 50 Hz.  Going back to the original frame of
reference, we have a vector of length 2 * cos(2 * pi * 50 * t) and
direction theta = 0 that we have just started spinning at 1050 Hz.  In
other words, you get a 1050 Hz sinewave that gets louder and softer
with a 100 Hz envelope. (Some people probably call this a 50 Hz
envelope.)

Algebraically, this is:

exp(j*f1* t) + exp(j*f2*t) = 	exp[j*t*(f1-f2)/2] * exp[j*t*(f1+f2)/2] +
				exp[j*t*(f2-f1)/2] * exp[j*t*(f1+f2)/2]

where f1 and f2 are the two angular frequencies and exp() is
exponentiation (e to the x).  Taking the real part of both sides:

cos(f1*t) + cos(f2*t) = cos[t*(f1-f2)/2]*cos[t*(f1+f2)/2] -
			sin[t*(f1-f2)/2]*sin[t*(f1+f2)/2] +
			cos[t*(f2-f1)/2]*cos[t*(f1+f2)/2] -
			sin[t*(f2-f1)/2]*sin[t*(f1+f2)/2]

We can simplify this because we know thet f2-f1 = -(f1-f2),
sin(-a)=-sin(a), and cos(-a) = cos(a).  The answer is:

2*cos[t*(f1-f2)/2]*cos[t*(f1+f2)/2]
				
Which really does get louder and softer.  In out case, we have:

v = 2*cos[2*pi*50*t]*cos[2*pi*1050*t]


>As far as viewing on a `scope, much of the same applies.  You can call the
>resulting waveform anything you want, but it still is a sum of sinusoids.

Try plotting out cos(2*pi*1000*t) + cos(2*pi*1100*t) on whatever is
most convenient.  It *does* look like a 1050 Hz wave with a 100 Hz
envelope.  Try plotting out some cases where the magnitudes are not
quite equal - like: 1.5*cos(2*pi*1000*t) + cos(2*pi*1100*t). You still
get beating; however, the magnitude never goes all the way down to
zero.

As you can see, the phenomenon of beating is more a consequence of
living in the time domain than any processing done by our ears or
brains. Nothing magic about it at all.

>mhorne@ka7axd.wv.tek.com


-- 
swass@apple.com