# 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.

# Details and Options • Spectrogram[list] plots the magnitude of the short-time Fourier transform (STFT), computed as discrete Fourier transform (DFT) of partitions of list.
• 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:
•  AspectRatio 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 .

# Examples

open all close all

## Basic Examples(2)

Spectrogram of a chirp signal:

 In:= Out= Spectrogram of an audio signal:

 In:= Out= ## Neat Examples(1)

Introduced in 2012
(9.0)
|
Updated in 2017
(11.2)
{"ft_lang_label":"__label__en","ft_lang_prob":0.8099605,"math_prob":0.8902473,"size":2614,"snap":"2019-51-2020-05","text_gpt3_token_len":575,"char_repetition_ratio":0.15249042,"word_repetition_ratio":0.0,"special_character_ratio":0.20772763,"punctuation_ratio":0.10822511,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.98043334,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],"im_url_duplicate_count":[null,4,null,4,null,4,null,4,null,4,null,4,null,4,null,4,null,4,null,4,null,4,null,3,null,1,null,1,null,1,null,1,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-01-20T14:19:32Z\",\"WARC-Record-ID\":\"<urn:uuid:64048874-b06e-46ea-b39b-1bf7d3ce9ba9>\",\"Content-Length\":\"82672\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:56a2d936-e7c8-48cb-ba45-7ebc67da3cd3>\",\"WARC-Concurrent-To\":\"<urn:uuid:ea149169-3ef0-4b37-be8e-0551dd32e726>\",\"WARC-IP-Address\":\"140.177.205.163\",\"WARC-Target-URI\":\"https://reference.wolfram.com/language/ref/Spectrogram.html\",\"WARC-Payload-Digest\":\"sha1:CTR43IQP6TKPLXRJ66H56HFMUDFQ6YMX\",\"WARC-Block-Digest\":\"sha1:HLRUF5STDFXEXHM5WKIUKJE5HBDO6L5R\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-05/CC-MAIN-2020-05_segments_1579250598800.30_warc_CC-MAIN-20200120135447-20200120164447-00124.warc.gz\"}"}