ShortTimeFourier

ShortTimeFourier[data]

returns the short-time Fourier transform (STFT) of data as a ShortTimeFourierData object.

ShortTimeFourier[data,n]

uses partitions of length n.

ShortTimeFourier[data,n,d]

uses partitions with offset d.

ShortTimeFourier[data,n,d,wfun]

applies a smoothing window wfun to each partition.

ShortTimeFourier[data,n,d,wfun,m]

pads partitions with zeros to length m prior to the computation of the transform.

Details and Options

  • The short-time Fourier transform (STFT) is a time-frequency representation of a signal and is typically used for transforming, filtering and analyzing the signal in both time and frequency.
  • ShortTimeFourier[data] computes the discrete Fourier transform (DFT) of partitions of data and returns a ShortTimeFourierData object.
  • Use Spectrogram on data or on the resulting ShortTimeFourierData object to plot the spectrogram.
  • ShortTimeFourier[data] uses partitions of length and offset , where is Length[data].
  • 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 ShortTimeFourier[data,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.
  • The data can be any of the following:
  • listarbitrary rank numerical array
    audioan Audio or Sound object
  • For multichannel audio objects, the spectrogram is computed over the sum of all channels.
  • ShortTimeFourier accepts the FourierParameters option. The default setting is FourierParameters->{1,-1}.

Examples

open all close all

Basic Examples  (2)

Short-time Fourier transform of a sine wave:

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

Short-time Fourier transform of an audio signal:

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

Plot the result:

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

Scope  (6)

Options  (3)

Applications  (6)

Properties & Relations  (2)

Introduced in 2019
(12.0)