# Sum of sinusoidals (frequency/phase of acoustic beats)

I have a function that's the sum of two sinusoidals: $A \cos(\Theta_1 + \omega_1 t) + B \cos(\Theta_2 + \omega_2 t)$. It basically forms an acoustic beat pattern. I need to find the frequency of the underlying pitch and the phase (that is, a place where there's a local maximum/minimum) for a numeric root finder I'm working on. The idea being that if you start at the phase and walk forward by 1/4 of the period of the underlying pitch you'll exactly reach the next local minimum/maximum.

I found a few articles taking about acoustic beats, and from those I have this trig identity in hand: $\sin(f_1(t)) + \sin(f_2(t)) = 2 \sin(\frac{f_1(t) + f_2(t)}{2}) \cos(\frac{f_1(t) - f_2(t)}{2})$. From that I can pull the underlying pitch (I think it's the higher frequency term of the average or half difference of the frequencies? That is, it's either $\frac{f_1(t) + f_2(t)}{2}$ or $\frac{f_1(t) - f_2(t)}{2}$).

But I'm not sure how to pull out the phase. And I also don't know how to handle cases where $A$ and $B$ aren't equal. From some graph experiments, I don't think it changes the underlying frequency/pitch at all(?) but it definitely seems to change the phase.

-

The $\cos \frac{f_1t-f_2t}2$ term will give an envelope that is a reflected pair of long period cosine waves. This is particularly evident if the two frequencies are close together. It shows up well in the lower plot from Alpha
The local min/max will be close to the min/max of the $\sin \frac{f_1t+f_2t}2$ term as this changes so quickly compared to the other one. These come at $\frac{f_1+f_2}2t=(n+\frac12)\pi$, so this would be be underlying pitch. The step from one extreme to the next is about (not exactly) $\frac12$ cycle of this, not $\frac14$ cycle, but again you can call this the underlying phase. The approximations get worse as the two frequencies get more different.
If $A$ and $B$ are different it isn't so clean. You can do $A \cos f_1t + B \cos f_2t=\frac{A+B}2(\cos f_1t + \cos f_2t) + \frac{A-B}2(\cos f_1t - \cos f_2 t)$ and get the sum of two of these beats.
Ah yes, $\frac{1}{2}$ not $\frac{1}{4}$; not sure why I was brain farting on that. The last trig identity you give there is really useful, too, thanks for that. Is there no way to get better than an approximation for the phase? – Jay Lemmon Dec 30 '11 at 1:01
@JayLemmon: If you think about differentiation as multiplying by $\omega=2\pi f$ (think of $\frac d{dt}\exp^{i\omega t}$) the slope of the low frequency wave is low. You could evaluate that slope at the peak of the fast wave, then figure out how that moves the zero of the derivative. So $0=f(t)g'(t)+f'(t)g(t)$. My approximation is $f'(t)=0$ because $g'(t)$ is small. The next order would be to consider $g'$ constant, so you want $f'(t)=\pm \frac{g'(t)}{g(t}$ because $f(t)\approx \pm 1$ – Ross Millikan Dec 30 '11 at 4:20