SpectrogramArray[list]
returns the spectrogram data of list.
SpectrogramArray[list,n]
uses partitions of length n.
SpectrogramArray[list,n,d]
uses partitions with offset d.
SpectrogramArray[list,n,d,wfun]
applies a smoothing window wfun to each partition.
SpectrogramArray[list,n,d,wfun,m]
pads partitions with zeros to length m prior to the computation of the transform.
SpectrogramArray[audio,…]
returns spectrogram data of audio.
SpectrogramArray[video]
returns the spectrogram data of the first audio track in video.
SpectrogramArray
SpectrogramArray[list]
returns the spectrogram data of list.
SpectrogramArray[list,n]
uses partitions of length n.
SpectrogramArray[list,n,d]
uses partitions with offset d.
SpectrogramArray[list,n,d,wfun]
applies a smoothing window wfun to each partition.
SpectrogramArray[list,n,d,wfun,m]
pads partitions with zeros to length m prior to the computation of the transform.
SpectrogramArray[audio,…]
returns spectrogram data of audio.
SpectrogramArray[video]
returns the spectrogram data of the first audio track in video.
Details and Options
- SpectrogramArray[list] returns the discrete Fourier transform (DFT) of partitions of list, also known as short-time Fourier transform (STFT).
- Plot the spectrogram using Spectrogram.
- SpectrogramArray[list] uses partitions of length
and offset
, where
is Length[list]. - The partition length n and offset d can be expressed as an integer number (interpreted as number of samples) or as time or sample quantities.
- If necessary, fixed padding is used on the right to make all the partitions the same size.
- In SpectrogramArray[list,n,d,wfun], the smoothing window wfun can be specified using a window function that will be sampled between
and
or a list of length n. The default window is DirichletWindow, which effectively does no smoothing. - SpectrogramArray works with numeric lists as well as Audio and Sound objects.
- For multichannel sound objects, the spectrogram is computed over the sum of all channels.
- SpectrogramArray accepts the FourierParameters option. The default setting is FourierParameters->{1,-1}.
Examples
open all close allBasic Examples (2)
Short-time Fourier transform of a sine wave:
data = Table[Sin[(π/4)3n ], {n, 0, 7}]SpectrogramArray[data, 4]//Chop//MatrixFormShort-time Fourier transform of an audio signal:
data = SpectrogramArray[\!\(\*AudioBox[""]\), 2048];
Short[data]MatrixPlot[Transpose[Log@Abs[data]][[1024 ;; ]], AspectRatio -> 1 / 3, FrameTicks -> None]Scope (2)
Magnitude spectrum of a single partition:
chirp = Table[Cos[200. π t + 2400. π t ^ 2], {t, 0., 1.6, 1 / 8000.}];ListLinePlot[Abs[SpectrogramArray[chirp][[30]]]]Plot of the magnitude of the SpectrogramArray data:
MatrixPlot[Abs[SpectrogramArray[chirp]], FrameTicks -> None]Apply a smoothing window function:
MatrixPlot[Abs[SpectrogramArray[chirp, Automatic, Automatic, HannWindow]], FrameTicks -> None]Short-time Fourier transform of the audio track of a video:
data = SpectrogramArray[\!\(\*VideoBox[""]\), 2048];
Short[data]MatrixPlot[Transpose[Log@Abs[data]][[1024 ;; ]], AspectRatio -> 1 / 3, FrameTicks -> None]Applications (2)
Short-time energy of an audio object:
a = \!\(\*AudioBox[""]\);sa = SpectrogramArray[a];ListLinePlot[Map[Total[Abs[#] ^ 2]&, sa], DataRange -> {0, 3.43}]Identify the numbers pressed on a phone keypad from a spectrogram:
f3 = {697, 1477};
f7 = {852, 1209};Create a sound with digits seven and three:
seven = Array[Sin[2Pi f7[[1]] #] + Sin[2Pi f7[[2]] #]&, 800, {0, .1}];
three = Array[Sin[2Pi f3[[1]] #] + Sin[2Pi f3[[2]] #]&, 800, {0, .1}];
a = Audio[Join[seven, ConstantArray[0, 50], three]]Magnitude of the spectrogram array of the sound:
sa = Abs[SpectrogramArray[a, 512, 32]];ListLinePlot[sa[[{10, 35}]], DataRange -> {0, 8000}, PlotRange -> {{500, 2000}, All}, Ticks -> {Automatic, None}]Find the peaks and calculate the frequencies:
(Flatten@Position[MaxDetect[sa[[10]]], 1][[ ;; 2]] - 1)8000 / 512.(Flatten@Position[MaxDetect[sa[[35]]], 1][[ ;; 2]] - 1)8000 / 512.Properties & Relations (2)
Fourier of partitions of lists is equivalent to SpectrogramArray:
list = RandomReal[1, 9]; sa = SpectrogramArray[list, 3, 3];
Map[InverseFourier[#, FourierParameters -> {1, -1}]&, sa] == Partition[list, 3]Compute the inverse of spectrogram of non-overlapping partitions:
list = RandomReal[1, 9]; sa = SpectrogramArray[list, 3, 3];
inv = Flatten[InverseFourier[# , FourierParameters -> {1, -1}]& /@ sa];
Max[list - inv]//ChopRelated Guides
History
Introduced in 2012 (9.0) | Updated in 2014 (10.0) ▪ 2016 (11.0) ▪ 2017 (11.2) ▪ 2024 (14.1)
Text
Wolfram Research (2012), SpectrogramArray, Wolfram Language function, https://reference.wolfram.com/language/ref/SpectrogramArray.html (updated 2024).
CMS
Wolfram Language. 2012. "SpectrogramArray." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/SpectrogramArray.html.
APA
Wolfram Language. (2012). SpectrogramArray. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SpectrogramArray.html
BibTeX
@misc{reference.wolfram_2026_spectrogramarray, author="Wolfram Research", title="{SpectrogramArray}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/SpectrogramArray.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_spectrogramarray, organization={Wolfram Research}, title={SpectrogramArray}, year={2024}, url={https://reference.wolfram.com/language/ref/SpectrogramArray.html}, note=[Accessed: 13-June-2026]}