In [27]:

```
from IPython.display import Audio
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.dates as mdates
import datetime as datetime
import sys , os
%matplotlib inline
```

Ipython is an

First we import **Audio** from **IPython**, then **NumPy**. These will make possible to not only generate sound, but work with numbers and further datasets.

The next two examples we can see the operations using **NumPy**, after the sound output using **Audio**

The first code modulates a 440 Hz carrier signal with a 520 Hz modulation signal. The modulation fignal (frequence modulation - fm) is the basis of FM radio and of FM synthesis.

In [28]:

```
import numpy
fs = 44100 # sampling frequency, Hz
fc = 440 # carrier frequency, Hz
fm = 520 # modulation frequency, Hz
T = 19.5 # seconds
twopi = 2*numpy.pi
t = numpy.linspace(0, T, int(T*fs), endpoint=False) # time variable
# Produce ramp from 0 to 1
beta = numpy.linspace(0, 5, int(T*fs))
output = numpy.sin(twopi*fc*t + beta*numpy.sin(twopi*fm*t))
from IPython.display import Audio
Audio(output, rate=fs)
```

Out[28]: