« View all new features in
Mathematica
9
◄
previous
|
next
►
New in
Mathematica
9
›
Built-in Signal Processing
Power Spectrum of a Series of Dual-Tone Multi-frequency (DTMF) Signals
Visualize the spectrogram of dual-tone signals coming from a dial pad.
In[1]:=
X
Manipulate[ Row[{Grid[ Partition[ MapIndexed[ Button[First[#2] /. {10 -> "*", 11 -> 0, 12 -> "#"}, (EmitSound[ Play[Sin[2 Pi #[[1]] t] + Sin[2 Pi #[[2]] t], {t, 0, .2}]]; signal = Join[signal, Table[Sin[2 Pi #1[[1]] t] + Sin[2 Pi #1[[2]] t], {t, 0, .2, 1/8000.}]]; p = Spectrogram[signal, 256, 128, BartlettWindow, SampleRate -> 8000, AspectRatio -> 1, ImageSize -> {Automatic, 180}]), ImageSize -> {40, 40}] &, Flatten[Outer[List, {697, 770, 852, 941}, {1209, 1336, 1477}], 1]], 3]], Spacer[30], Dynamic[p]}, Alignment -> Top], Initialization :> ( signal = Table[Sin[2 Pi 697 t] + Sin[2 Pi 1209 t], {t, 0., 0.2, 1/8000.}]; p = Spectrogram[signal, 256, 128, BartlettWindow, SampleRate -> 8000, AspectRatio -> 1, ImageSize -> {Automatic, 180}])]
Out[1]=