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.
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]
-
- 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 .
-
AspectRatio 1/3 ratio of height to widthImageMargins 0. the margins to leave around the graphicPreserveImageOptions Automatic whether to preserve image options when displaying new versions of the same graphic
List of all options
Examples
open all close allBasic Examples (2)
Spectrogram of a chirp signal:
Spectrogram of an audio signal:
Scope (2)
Use a specific window size and offset:
By default, a suitable window size and offset is chosen:
Use smaller window size to reduce the frequency resolution:
Use larger window size to improve the frequency resolution:
Specify the smoothing window function:
No smoothing:
Spectrogram of the audio track of a video:
Options (34)
AspectRatio (1)
By default, Spectrogram uses a fixed height-to-width ratio for the plot:
Make the height the same as the width with AspectRatio 1:
AspectRatio Automatic determines the ratio from the plot ranges:
AspectRatio Full adjusts the height and width to tightly fit inside other constructs:
Axes (3)
By default, Spectrogram uses a frame instead of axes:
Use axes instead of a frame:
Turn on each axis individually:
AxesLabel (3)
No axes labels are drawn by default:
Place a label on the axis:
Specify axes labels:
AxesOrigin (2)
The position of the axes is determined automatically:
Specify an explicit origin for the axes:
AxesStyle (3)
Change the style for the axes:
Specify the style of each axis:
Use different styles for the ticks and the axes:
ColorFunction (1)
Use a built-in color gradient as the color function:
Use an arbitrary color function:
ImageSize (7)
Use named sizes such as Tiny , Small , Medium and Large :
Specify the width of the plot:
Specify the height of the plot:
Allow the width and height to be up to a certain size:
Specify the width and height for a graphic, padding with space if necessary:
Setting AspectRatio Full will fill the available space:
Use maximum sizes for the width and height:
Use ImageSize Full to fill the available space in an object:
Specify the image size as a fraction of the available space:
Method (1)
By default, frequency is shown using linear scaling:
Use mel frequency scaling:
PlotRange (4)
PlotRange->Automatic automatically computes the frequency range to display:
This is equivalent to PlotRange->{All ,Automatic ,All }:
Show the full spectrogram:
Zoom into a specific part of the spectrogram:
Use PlotRange->{min,max} to control the frequency range of the spectrogram:
Specify range of frequencies:
Specify maximum frequency:
SampleRate (1)
Specify the sampling rate of the data:
Ticks (4)
TicksStyle (4)
Specify the overall tick style, including the tick labels:
Specify the tick style for each of the axes:
Specify tick marks with scaled lengths:
Customize each tick with position, length, labeling and styling:
Applications (3)
Spectrogram of a sound signal:
Spectrogram of an impulsive sound:
Spectrogram of an image:
Properties & Relations (1)
Create a spectrogram from the SpectrogramArray :
Comparison with the default Spectrogram output:
Neat Examples (1)
Sound and spectrogram of dual-tone for Wolfram Research customer service number:
History
Introduced in 2012 (9.0) | Updated in 2014 (10.0) ▪ 2016 (11.0) ▪ 2017 (11.2) ▪ 2024 (14.1)
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
BibTeX
@misc{reference.wolfram_2025_spectrogram, author="Wolfram Research", title="{Spectrogram}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/Spectrogram.html}", note=[Accessed: 16-November-2025]}
BibLaTeX
@online{reference.wolfram_2025_spectrogram, organization={Wolfram Research}, title={Spectrogram}, year={2024}, url={https://reference.wolfram.com/language/ref/Spectrogram.html}, note=[Accessed: 16-November-2025]}