Hacker News new | ask | show | jobs
by JadeNB 4939 days ago
> Bonus: you can add the phase values, 2 sin(x + phase), to get the beats just right.

Fortunately, you don't need to do so; if the complex number z = A + iB has magnitude r and argument theta, then Acos(t) + Bsin(t) is the same as r*cos(t - theta). That is, combining cosines and sines of the same frequency already accounts for the phase shift.