Spectrogram

Spectrogram[list]

plots the spectrogram of list.

Spectrogram[list,n]

uses partitions of length n.

Spectrogram[list,n,d]

uses partitions with offset d.

Spectrogram[list,n,d,wfun]

applies a smoothing window wfun to each partition.

Spectrogram[audio,]

plots the spectrogram of audio.

Details and Options

  • Spectrogram[list] plots the magnitude of discrete Fourier transforms of partitions of list.
  • Spectrogram[list] uses partitions of length n=2^Round[InterpretationBox[{log, _, DocumentationBuild`Utils`Private`Parenth[2]}, Log2, AutoDelete -> True](sqrt(m))]+1 and offset Round[n/3], where m 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.
  • Spectrogram displays only the first half of the magnitude of the discrete Fourier transform due to the symmetry property of the transform.
  • In Spectrogram[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.
  • Spectrogram 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.
  • Compute the effective discrete Fourier transforms of partitions using SpectrogramArray.
  • Spectrogram accepts all ArrayPlot options with the following additions and changes:
  • AspectRatio1/3ratio of height to width
    ColorFunctionAutomatichow each cell should be colored
    FrameTicksAutomaticwhat ticks to include on the frame
    MaxPlotPointsAutomaticthe maximum number of points to include
    SampleRateAutomaticsampling rate assumed for the input list
  • For the setting SampleRate->r and a list of length m, time is ranged from 0 to m/r, and the frequencies are in the range 0 to r/2.

Examples

open allclose all

Basic Examples  (2)

Spectrogram of a chirp signal:

In[2]:=
Click for copyable input
Out[2]=

Spectrogram of an audio signal:

In[1]:=
Click for copyable input
Out[1]=

Scope  (1)

Options  (4)

Applications  (2)

Properties & Relations  (1)

Neat Examples  (1)

See Also

SpectrogramArray  Fourier  Periodogram  Cepstrogram  AudioSpectralTransformation

Introduced in 2012
(9.0)
| Updated in 2017
(11.1)