# What's the best way to approximate two added sine waves with one?

Background: I'm writing a synthesizer with the creative limitation that it uses a single oscillator and a single amplitude multiplier.

$$y=\sin(t*f(t))*a(t)$$

$$(t=$$time, $$f=$$frequency, $$a=$$ amplitude$$)$$

What I'd like to do is cheat a bit and create something that approximates the sound of two sine waves using the above formula.

To put this mathematically,

What functions, $$a$$ and $$f$$, can I use in the above formula to get as close as possible to the following formula:

$$y=\sin(t*f_1)*a_1+\sin(t*f_2)*a_2$$

I don't believe that it's possible to find an exact way to emulate the second formula with the first but I'm assuming one could get pretty close.

• The standard techniques are to utilise a higher frequency carrier wave and encode the lower frequency sounds using either amplitude modulation or frequency modulation. However you then need to extract the sound signal from the carrier wave before it goes to a loudspeaker or other sound generation device. However I think you want to use amplitude and/or frequency modulation of a single sound frequency in order to trick the ear into hearing two completely separate sound frequencies. I can't think of a way to do it without hiding oscillators in the amplitude function which would be cheating. – James Arathoon Sep 8 '19 at 1:25
• @james Arathoon, I actually assumed you'd need to put oscillators in the amplitude function. What I can't seem to get is the formula for the amplitude given the 4 variables (f0,f1,a0,a1). It's not any standard waveform I know of. – Audiomatt Sep 8 '19 at 12:08
• If $a_1=a_2$ you can use the sum-to-product identity to get what you want.$f(t)$ is just the average of the two frequencies and $a(t)$ is a sine wave at half the difference. – Ross Millikan Sep 9 '19 at 9:46

Hint:

If you allow variable amplitude and variable frequency, there is more than you need. You can try to construct a phase function ($$t\,f(t)$$) that takes the values $$k\pi$$ at the successive zeroes of $$y$$, then find the amplitude function as

$$a(t)=\frac{y(t)}{\sin(t\,f(t))}.$$

Needless to say, this is more complex to design than a double oscillator.

Think what happens if $$\sin(t f(t)) = 0$$ then $$a(t)$$ would need to be infinite to create $$y \neq 0$$. Since this is not a physical/numerically tractable solution, $$\sin(t f(t))$$ must have the same zero crossings as the desired $$y(t)$$. This imposes quite a restriction.

It is not impossible though but quite difficult.

$$f(t)$$ can be obtained by observing the phase of the analytic signal of the desired $$y$$. That is

$$t f(t) = \arg \{ a_1 \exp(t f_1) + a_2 \exp(t f_2) \}$$.

This is quite tedious to calculate, but possible. Then $$a(t)$$ is just given by the ratio of $$y$$ and the sine waveform with $$f(t)$$.

## The better way

In signal processing one makes ones life much easier when using a complex oscillator. That is

$$y(t) = \Re \{\exp ( -\mathrm i f(t) t) a(t) \} = a_r(t) \cos(f(t) t) + a_i(t) \sin( f(t) t)$$

with $$a(t) = a_r(t) + \mathrm i a_i(t)$$ the complex amplitude envelope.

Then it is very easy to create a two (or more) tone signal. Just set

$$a(t) = a_1 \exp ( -\mathrm i (f_1 - f(t)) t) ) + a_2 \exp ( -\mathrm i (f_2 - f(t)) t) )$$

This works for arbitrary $$f(t)$$.

Note: The quantity $$f(t)$$ is not a frequency. The instantaneous (angular) frequency is $$\frac{d}{dt} (t f(t))$$. So $$f(t)$$ is only a frequency if it is time-independent (let alone the $$2 \pi$$ factor).