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[list,n,d,wfun,m]
pads partitions with zeros to length m prior to the computation of the transform.
Spectrogram[audio,…]
plots the spectrogram of audio.
Spectrogram[video]
plots the spectrogram of the first audio track in video.
Details and Options
- Spectrogram is also known as time-frequency plot.
- A spectrogram is a common visualization technique that shows how the frequency content of a signal changes over time.
- Spectrogram plots the magnitude of the short-time Fourier transform (STFT), computed as a discrete Fourier transform (DFT) of partitions of data.
- Compute the short-time Fourier transform of list using ShortTimeFourier.
- Spectrogram[list] uses partitions of length and offset , 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.
- Spectrogram accepts all ArrayPlot options with the following additions and changes: [List of all options]
-
AspectRatio 1/3 ratio of height to width ColorFunction Automatic how each cell should be colored FrameTicks Automatic what ticks to include on the frame MaxPlotPoints Automatic the maximum number of points to include Method Automatic method used for frequency binning PlotRange Automatic the range of values to plot SampleRate Automatic sampling rate assumed for the input list - Possible settings for Method include:
-
Automatic automatic choice of binning "LinearFrequency" no binning "MelFrequency" binning according to the mel scale - Use Method->{"MelFrequency",n,fmin,fmax} to specify the number of bins n as well as the minimum and maximum frequencies.
- Specific settings for PlotRange can be used to control the maximum frequency:
-
"Music" {0,10000} common frequency range for music "Speech" {0,5000} common frequency range for speech - For the setting SampleRate->r and a list of length m, time is ranged from to , and the frequencies are in the range to .
-
AlignmentPoint Center the default point in the graphic to align with AspectRatio 1/3 ratio of height to width Axes False whether to draw axes AxesLabel None axes labels AxesOrigin Automatic where axes should cross AxesStyle {} style specifications for the axes Background None background color for the plot BaselinePosition Automatic how to align with a surrounding text baseline BaseStyle {} base style specifications for the graphic ClippingStyle None how to show cells whose values are clipped ColorFunction Automatic how each cell should be colored ColorFunctionScaling True whether to scale the argument to ColorFunction ColorRules Automatic rules for determining colors from values ContentSelectable Automatic whether to allow contents to be selected CoordinatesToolOptions Automatic detailed behavior of the coordinates tool DataRange All the range of and values to assume DataReversed False whether to reverse the order of rows Epilog {} primitives rendered after the main plot FormatType TraditionalForm the default format type for text Frame Automatic whether to draw a frame around the plot FrameLabel None labels for rows and columns FrameStyle {} style specifications for the frame FrameTicks Automatic what ticks to include on the frame FrameTicksStyle {} style specifications for frame ticks GridLines None grid lines to draw GridLinesStyle {} style specifications for grid lines ImageMargins 0. the margins to leave around the graphic ImagePadding All what extra padding to allow for labels etc. ImageSize Automatic the absolute size at which to render the graphic LabelStyle {} style specifications for labels MaxPlotPoints Automatic the maximum number of points to include Mesh False whether to draw a mesh MeshStyle GrayLevel[GoldenRatio-1] the style to use for a mesh Method Automatic method used for frequency binning PlotLabel None an overall label for the plot PlotLegends None legends for datasets PlotRange Automatic the range of values to plot PlotRangeClipping False whether to clip at the plot range PlotRangePadding Automatic how much to pad the range of values PlotRegion Automatic the final display region to be filled PlotTheme $PlotTheme overall theme for the plot PreserveImageOptions Automatic whether to preserve image options when displaying new versions of the same graphic Prolog {} primitives rendered before the main plot RotateLabel True whether to rotate y labels on the frame SampleRate Automatic sampling rate assumed for the input list TargetUnits Automatic units to display in the plot Ticks Automatic axes ticks TicksStyle {} style specifications for axes ticks
List of all options
Examples
open allclose allScope (2)
Options (7)
Applications (3)
Properties & Relations (1)
Create a spectrogram from the SpectrogramArray:
Comparison with the default Spectrogram output:
Text
Wolfram Research (2012), Spectrogram, Wolfram Language function, https://reference.wolfram.com/language/ref/Spectrogram.html (updated 2024).
CMS
Wolfram Language. 2012. "Spectrogram." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/Spectrogram.html.
APA
Wolfram Language. (2012). Spectrogram. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Spectrogram.html