Wolfram Language

Computational Audio

AM Radio

Start with a band-limited signal.

In[1]:=
Click for copyable input
a = BandpassFilter[ AudioNormalize@ AudioResample[Import["ExampleData/rule30.wav"], 96000], {Quantity[ 10, "Hertz"], Quantity[5000, "Hertz"]}, 201]
Out[1]=
In[2]:=
Click for copyable input
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]:=
Click for copyable input
amsignal = ((.5 + a) AudioGenerator[{"Sin", Quantity[22050, "Hertz"]}, Duration@a])/2
Out[3]=
In[4]:=
Click for copyable input
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]:=
Click for copyable input
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]:=
Click for copyable input
BandpassFilter[# - Mean@# &@ MaxFilter[amsignal, 4], {Quantity[100, "Hertz"], Quantity[5000, "Hertz"]}, 201]
Out[6]=

Related Examples

de es fr ja ko pt-br ru zh