Wolfram Mathematica

In[1]:=
```a = BandpassFilter[ AudioNormalize@ AudioResample[Import["ExampleData/rule30.wav"], 96000], {Quantity[ 10, "Hertz"], Quantity[5000, "Hertz"]}, 201]```
Out[1]=
In[2]:=
```Periodogram[a, 2000, ImageSize -> Small, PlotRange -> {{0, 10000}, All}]```
Out[2]=

Modulate the amplitude with a 22,050 Hz sinusoid to shift the content at the high end of the spectrum. The result should be already inaudible for most people.

In[3]:=
```amsignal = ((.5 + a) AudioGenerator[{"Sin", Quantity[22050, "Hertz"]}, Duration@a])/2```
Out[3]=
In[4]:=
`Periodogram[amsignal, 2200, ImageSize -> Small]`
Out[4]=

Demodulate the AM signal by multiplying the result by another sinusoid at 22,050 Hz with the same phase.

In[5]:=
```result = BandpassFilter[ amsignal*AudioGenerator[{"Sin", Quantity[22050, "Hertz"]}, Duration@amsignal], {Quantity[100, "Hertz"], Quantity[5000, "Hertz"]}, 201]```
Out[5]=

Use a nonlinear filter to demodulate an AM signal.

In[6]:=
```BandpassFilter[# - Mean@# &@ MaxFilter[amsignal, 4], {Quantity[100, "Hertz"], Quantity[5000, "Hertz"]}, 201]```
Out[6]=