### Algorithm To encode a signal $x_m$ in a carrier with frequency $f_c$, we [proceed as](https://www.wikiwand.com/en/Frequency_modulation): $$ y(t) = \cos(\phi(t)), \\ \phi(t) = 2\pi \cdot \left(f_c t + f_\Delta \int_0^t x_m(\tau)d\tau \right) $$ where $f_\Delta$ controls the maximum deviation of $y$'s instantaneous frequency from $f_c$ (effectively its bandwidth, but not in strict Fourier sense). Discrete-time implementation is as follows: 1. Integrate via cumulative sum 2. Ensure $t$ is sampled properly per sampling frequency, i.e. $f_s = 1 / (t[1] - t[0])$. In Python this means `linspace(t_min, t_max, N / (t_max - t_min), endpoint=False)` 3. Ensure $\phi(t)$ [does not exceed](https://dsp.stackexchange.com/a/70594/50076) $\pi$, adjusting $f_\Delta$ as necessary 2. Ensure $f_c \leq f_s/2 - f_\Delta$, where $f_s$ is sampling frequency. ### Applied example Doing all of the above for the first 1 second of OP's attached data yields below, which is validated with direct inspection, and using synchrosqueezed CWT with an extremely time-localized wavelet: [![enter image description here][1]][1] Zooming (note, CWT is logscale, so lower part appears "stretched"): [![enter image description here][2]][2] Zooming even more, and showing the result: [![enter image description here][3]][3] ### Code Available at [Github](https://github.com/OverLordGoldDragon/StackExchangeAnswers/blob/main/SignalProcessing/Q76463%20-%20FM%20-%20Frequency%20Modulating%20a%20Signal/main.py). [1]: https://i.sstatic.net/yuBOI.png [2]: https://i.sstatic.net/CB15U.png [3]: https://i.sstatic.net/zfG7X.png