Skip to content

Latest commit

 

History

History
514 lines (435 loc) · 16.5 KB

pm-fm-equivalence.md

File metadata and controls

514 lines (435 loc) · 16.5 KB

When is Phase Modulation (PM) synthesis equivalent to Frequency Modulation (FM) synthesis, and when do they differ?

Table of Contents

Oscillator Basics

The signal generated by an oscillator can be modeled as a function of time $O(t)$ where $t$ denotes time, and $O \colon \mathbb{R} \to \mathbb{R}$.

An oscillator has a waveform associated with it which determines the shape of the signal. A waveform is a periodic function; for example, in the simplest case, it can be the good old trigonometric sine function. A bare $O(t) = \sin(t)$ signal can be thought of as a wave which oscillates once every $2\pi$ seconds.

To make it oscillate once every second instead (ie. at 1 Hz), we need to scale its input by $2\pi$, so it becomes

$$ O(t) = \sin(2\pi \cdot t) $$

To make it oscillate 10 times per second (ie. at 10 Hz), its input needs to be scaled even more:

$$ O(t) = \sin(2\pi \cdot 10 \cdot t) $$

To make it oscillate at a constant frequency $f$, the input needs to be multiplied by $f$:

$$ O(t) = \sin(2\pi \cdot f \cdot t) $$

If we also want this signal to start at a different portion of the sine wave at $t = 0$ seconds, then we need to shift its input by some number $\varphi \in \mathbb{R}$, which is called the phase or phase offset:

$$ O(t) = \sin(2\pi \cdot f \cdot t + \varphi) $$

We can also change the signal's amplitude by multiplying the whole thing by some number $A \in \mathbb{R}$:

$$ O(t) = A \cdot \sin(2\pi \cdot f \cdot t + \varphi) $$

(See also: Sine wave.)

Now let's think for a moment: what does $2\pi \cdot f \cdot t + \varphi$ actually represent here?

Well, the input to the sine function can be thought of as an angle measured in radians (hence the $2\pi$). And whatever this angle is measuring (e.g. it could be the rotation of a tonewheel), seems to be changing over time, since we have a time-dependent term in there. The trick is that the "rate of change" of this angle is what frequency actually measures, telling us how many full rotations are completed per second, just like velocity in physics measures how many meters are traveled per second. Therefore, $2\pi \cdot f \cdot t + \varphi$ here represents the total rotation of something (e.g. a tonewheel) that has accumulated over $t$ seconds. In other words, we aren't just multiplying frequency and time together, what we're acutally doing here is that we are summing infinitesimally small rotations (i.e. changes of angle) over a length of time! So our equation should really look like this:

$$ O(t) = A \cdot \sin \left(2\pi \cdot \int_{0}^{t} f \ d\tau + \varphi \right) $$

And this isn't just some arbitrary, unnecesessary pedantry, because it actually makes a huge difference when we replace the constant frequency with one that is changing over time, which we are going to need if we want to model frequency modulation that is all about changing the frequency rapidly in each moment.

(See also: Instantaneous phase and frequency.)

So let's replace that constant $f$ with a function $f \colon \mathbb{R} \to \mathbb{R}$:

$$ O(t) = A \cdot \sin \left( 2\pi \cdot \int_{0}^{t} f(\tau) \ d\tau + \varphi \right) $$

Finally, we can replace $\sin(t)$ with some other periodic function $W \colon \mathbb{R} \to \mathbb{R}$ to get a different waveform (like sawtooth, triangle, etc.):

$$ O(t) = A \cdot W \left( 2\pi \cdot \int_{0}^{t} f(\tau) \ d\tau + \varphi \right) $$

Modulator and Carrier

We have two oscillators, the Modulator and the Carrier. In the simplest case, they are connected in a way which lets the Modulator to affect one of the parameters of the Carrier. For example, for each $t$ moment in time, we add the momentary signal value of the Modulator to the selected parameter of the Carrier.

To see how Phase Modulation (PM) and Frequency Modulation (FM) are related to each other, we are going to mathematically model FM, and see if we can throw enough algebra at it to turn it into PM, then look at what happens to the modulator function in the process.

The signals generated by the two oscillators will be modeled as functions of time, like we have seen above: $M(t)$ and $C(t)$ for the Modulator and the Carrier respectively, $M \colon \mathbb{R} \to \mathbb{R}$ and $C \colon \mathbb{R} \to \mathbb{R}$.

For simplicity's sake, let's define $M(t)$ with a constant frequency $f_M \in \mathbb{R}$, and a constant amplitude $A_M \in \mathbb{R}$, with zero phase offset ($\varphi_M = 0$), and with a waveform $W_M \colon \mathbb{R} \to \mathbb{R}$:

$$ \begin{align} (1) \quad M(t) = & A_M \cdot W_M(2\pi \cdot f_M \cdot t + \varphi_M) \\ = & A_M \cdot W_M(2\pi \cdot f_M \cdot t + 0) \\ = & A_M \cdot W_M(2\pi \cdot f_M \cdot t) \end{align} $$

Now let's define the Carrier's function with varying frequency; similarly to the above, $A_C \in \mathbb{R}$ is the amplitude, $\varphi_C \in \mathbb{R}$ is the phase offset, $f_{FM} \colon \mathbb{R} \to \mathbb{R}$ is the varying frequency, and $W_C \colon \mathbb{R} \to \mathbb{R}$ is the waveform:

$$ (2) \quad C(t) = A_C \cdot W_C \left( 2\pi \cdot \int_{0}^{t} f_{FM}(\tau) \ d\tau + \varphi_C \right) $$

Let's say that the Carrier's own frequency is a constant $f_C \in \mathbb{R}$, and this is what we are modulating with $M$, so $f_{FM}(\tau)$ can be expressed as

$$ f_{FM}(\tau) = M(\tau) + f_C $$

It can already be seen that modulating the frequency by some function is equivalent to modulating the phase by an antiderivative of that function (see Fundamental theorem of calculus), and those two are only equivalent in very special cases, but let's see the math in detail now.

Turning FM into PM

Substituting $f_{FM}(\tau) = M(\tau) + f_C$ into equation $(2)$ and then expanding $M$, we get

$$ \begin{align} (3) \quad C(t) = & A_C \cdot W_C \left( 2\pi \cdot \int_{0}^{t} \left( M(\tau) + f_C \ d\tau \right) + \varphi_C \right) \\ = & A_C \cdot W_C \left( 2\pi \cdot \int_{0}^{t} M(\tau) \ d\tau + 2\pi \cdot \int_{0}^{t} f_C \ d\tau + \varphi_C \right) \\ = & A_C \cdot W_C \left( 2\pi \cdot \int_{0}^{t} A_M \cdot W_M(2\pi \cdot f_M \cdot \tau) \ d\tau + 2\pi \cdot f_C \cdot t + \varphi_C \right) \\ = & A_C \cdot W_C \left( 2\pi \cdot A_M \cdot \int_{0}^{t} W_M(2\pi \cdot f_M \cdot \tau) \ d\tau + 2\pi \cdot f_C \cdot t + \varphi_C \right) \end{align} $$

Thanks to Fourier, we know that periodic functions can be expressed as sums of sinusoids, so for simplicity's sake, let's consider only those waveforms for the Modulator where, for some $N \in \mathbb{N}$, $W_M$ can be written as

$$ (4) \quad W_M(\tau) = \sum_{n=1}^{N} \left( B_n \sin(n\tau) \right) $$

where $B_n \in \mathbb{R}$ are some constants for $1 \le n \le N, \ n \in \mathbb{N}$.

Expressing $W_M$ in the integral in equation $(3)$ as a sum of sines yields

$$ \begin{align} (5) \quad \int_{0}^{t} W_M(2\pi \cdot f_M \cdot \tau) \ d\tau = & \int_{0}^{t} \sum_{n=1}^{N} B_n \sin(2\pi \cdot f_M \cdot n \cdot \tau) \ d\tau \\ = & \sum_{n=1}^{N} B_n \int_{0}^{t} \sin(2\pi \cdot f_M \cdot n \cdot \tau) \ d\tau \end{align} $$

Using the fact that for any constant $0 \neq \gamma \in \mathbb{R}$:

$$ \int \sin(\gamma x) \ dx = - \frac{1}{\gamma} \cos(\gamma x) + c \quad (c \in \mathbb{R}) $$

we can calculate the integral in the right side of equation $(5)$:

$$ \begin{align} (6) \quad \int_{0}^{t} \sin(2\pi \cdot f_M \cdot n \cdot \tau) \ d\tau = & \left[ - \frac{1}{2\pi \cdot f_M \cdot n} \cdot \cos(2\pi \cdot f_M \cdot n \cdot \tau) \right]_0^t \\ = & - \frac{1}{2\pi \cdot f_M \cdot n} \cdot \left[ \cos(2\pi \cdot f_M \cdot n \cdot \tau) \right]_0^t \\ = & - \frac{1}{2\pi \cdot f_M \cdot n} \cdot ( \cos(2\pi \cdot f_M \cdot n \cdot t) - \cos(2\pi \cdot f_M \cdot n \cdot 0) ) \\ = & - \frac{1}{2\pi \cdot f_M \cdot n} \cdot ( \cos(2\pi \cdot f_M \cdot n \cdot t) - \cos(0) ) \\ = & - \frac{1}{2\pi \cdot f_M \cdot n} \cdot ( \cos(2\pi \cdot f_M \cdot n \cdot t) - 1 ) \\ = & - \frac{ \cos(2\pi \cdot f_M \cdot n \cdot t) - 1 }{2\pi \cdot f_M \cdot n} \\ = & \frac{ 1 - \cos(2\pi \cdot f_M \cdot n \cdot t) }{2\pi \cdot f_M \cdot n} \end{align} $$

Furthermore, since $\sin(x-\frac{\pi}{2}) = -\cos(x)$, the result in equation $(6)$ can be written as

$$ \int_{0}^{t} \sin(2\pi \cdot f_M \cdot n \cdot \tau) \ d\tau = \frac{ 1 + \sin \left( 2\pi \cdot f_M \cdot n \cdot t - \frac{\pi}{2} \right) }{2\pi \cdot f_M \cdot n} $$

Plugging this back into the right side of equation $(5)$:

$$ \begin{align} (7) \quad \sum_{n=1}^{N} B_n \int_{0}^{t} \sin(2\pi \cdot f_M \cdot n \cdot \tau) \ d\tau = & \sum_{n=1}^{N} B_n \frac{1 + \sin \left( 2\pi \cdot f_M \cdot n \cdot t - \frac{\pi}{2} \right)}{2\pi \cdot f_M \cdot n} \\ = & \sum_{n=1}^{N} \frac{B_n}{2\pi \cdot f_M \cdot n} + \frac{1}{2\pi \cdot f_M} \sum_{n=1}^{N} \frac{B_n}{n} \sin \left( 2\pi \cdot f_M \cdot n \cdot t - \frac{\pi}{2} \right) \end{align} $$

Let's define two more constants, $\alpha \in \mathbb{R}$ and $\beta \in \mathbb{R}$:

$$ \begin{align} \alpha = & \sum_{n=1}^{N} \frac{B_n}{2\pi \cdot f_M \cdot n} \\ \beta = & \frac{1}{2\pi \cdot f_M} \end{align} $$

Now we can rewrite equation $(7)$ as

$$ \begin{align} (8) \quad \sum_{n=1}^{N} B_n \int_{0}^{t} \sin(2\pi \cdot f_M \cdot n \cdot \tau) \ d\tau = & \ \alpha + \beta \sum_{n=1}^{N} \frac{B_n}{n} \sin \left( 2\pi \cdot f_M \cdot n \cdot t - \frac{\pi}{2} \right) \end{align} $$

Continuing equation $(5)$ using equation $(8)$:

$$ \begin{align} (9) \quad \int_{0}^{t} W_M(2\pi \cdot f_M \cdot \tau) \ d\tau = & \ \alpha + \beta \sum_{n=1}^{N} \frac{B_n}{n} \sin \left( 2\pi \cdot f_M \cdot n \cdot t - \frac{\pi}{2} \right) \end{align} $$

By plugging this back into equation $(3)$, we get:

$$ \begin{align} (10) \quad C(t) = & A_C \cdot W_C \left( 2\pi \cdot A_M \cdot \int_{0}^{t} W_M(2\pi \cdot f_M \cdot \tau) \ d\tau + 2\pi \cdot f_C \cdot t + \varphi_C \right) \\ = & A_C \cdot W_C \left( 2\pi \cdot A_M \cdot \left( \alpha + \beta \sum_{n=1}^{N} \frac{B_n}{n} \sin \left( 2\pi \cdot f_M \cdot n \cdot t - \frac{\pi}{2} \right) \right) + 2\pi \cdot f_C \cdot t + \varphi_C \right) \\ = & A_C \cdot W_C \left( 2\pi \cdot A_M \cdot \alpha + 2\pi \cdot A_M \cdot \beta \sum_{n=1}^{N} \frac{B_n}{n} \sin \left( 2\pi \cdot f_M \cdot n \cdot t - \frac{\pi}{2} \right) + 2\pi \cdot f_C \cdot t + \varphi_C \right) \\ = & A_C \cdot W_C \left( 2\pi \cdot f_C \cdot t + \varphi_C + 2\pi \cdot A_M \cdot \alpha + 2\pi \cdot A_M \cdot \beta \sum_{n=1}^{N} \frac{B_n}{n} \sin \left( 2\pi \cdot f_M \cdot n \cdot t - \frac{\pi}{2} \right) \right) \end{align} $$

Finally, we can define two more constants $A_{FM} \in \mathbb{R}$ and $\varphi_{FM} \in \mathbb{R}$ as

$$ \begin{align} A_{FM} = & \ 2\pi \cdot A_M \cdot \beta \\ = & \ 2\pi \cdot A_M \cdot \frac{1}{2\pi \cdot f_M} \\ = & \frac{A_M}{f_M} \\ \varphi_{FM} = & \ \varphi_C + 2\pi \cdot A_M \cdot \alpha \\ = & \ \varphi_C + 2\pi \cdot A_M \cdot \sum_{n=1}^{N} \frac{B_n}{2\pi \cdot f_M \cdot n} \\ = & \ \varphi_C + \frac{A_M}{f_M} \cdot \sum_{n=1}^{N} \frac{B_n}{n} \end{align} $$

With these, equation $(10)$ simplifies to

$$ \begin{align} (11) \quad C(t) = & A_C \cdot W_C \left( 2\pi \cdot f_C \cdot t + \varphi_{FM} + A_{FM} \sum_{n=1}^{N} \frac{B_n}{n} \sin \left( 2\pi \cdot f_M \cdot n \cdot t - \frac{\pi}{2} \right) \right) \end{align} $$

Conclusion

For the special case of $N=1$ in equation $(4)$, equation $(11)$ becomes

$$ \begin{align} (12) \quad C(t) = & A_C \cdot W_C \left( 2\pi \cdot f_C \cdot t + \varphi_{FM} + A_{FM} \cdot B_1 \sin \left( 2\pi \cdot f_M \cdot t - \frac{\pi}{2} \right) \right) \\ = & A_C \cdot W_C \left( 2\pi \cdot f_C \cdot t + \varphi_{FM} + A_{FM} \cdot W_M \left( 2\pi \cdot f_M \cdot t - \frac{\pi}{2} \right) \right) \end{align} $$

which is indeed the same as if we added a constant offset to $\varphi_C$ and then modulated it by a slight variation of the original modulator signal which would have an amplitude of $A_{FM}$ and a phase offset of $- \frac{\pi}{2}$ (see equation $(1)$ ):

$$ \begin{align} M(t) = & A_M \cdot W_M (2\pi \cdot f_M \cdot t + 0) \\ \hat{M_1}(t) = & A_{FM} \cdot W_M \left( 2\pi \cdot f_M \cdot t - \frac{\pi}{2} \right) \\ C(t) = & A_C \cdot W_C \left( 2\pi \cdot \int_{0}^{t} \left( M(\tau) + f_C \ d\tau \right) + \varphi_C \right) \\ = & A_C \cdot W_C \left( 2\pi \cdot f_C \cdot t + \varphi_{FM} + \hat{M_1}(t) \right) \end{align} $$

Therefore for $N = 1$, phase modulation and frequency modulation are indeed equivalent.

But for $N \gt 1$, if we express the frequency modulated $C(t)$ signal as a phase modulated signal, as can bee seen from equation $(11)$, we get a modulator signal which has a significantly different harmonic content from the original $M(t)$ (because the original $B_n$ coefficients of $W_M$ get replaced with $\frac{B_n}{n}$ ):

$$ \begin{align} M(t) = & A_M \cdot \sum_{n=1}^{N} B_n \sin( 2\pi \cdot f_M \cdot n \cdot t) \\ \hat{M_N}(t) = & A_{FM} \sum_{n=1}^{N} \frac{B_n}{n} \sin \left( 2\pi \cdot f_M \cdot n \cdot t - \frac{\pi}{2} \right) \\ C(t) = & A_C \cdot W_C \left( 2\pi \cdot \int_{0}^{t} \left( M(\tau) + f_C \ d\tau \right) + \varphi_C \right) \\ = & A_C \cdot W_C \left( 2\pi \cdot f_C \cdot t + \varphi_{FM} + \hat{M_N}(t) \right) \end{align} $$

(And indeed, $\hat{M_N}(t)$ is an antiderivative of $M(t)$.)

Thus, modulating the frequency with a harmonically complex $M(t)$ signal is significantly different from modulating directly the phase with it, therefore, in the general case, PM is not always equivalent to FM.