plot the spectrogram of a signal
string, rtable, list : a signal, the name of a file containing a signal, or a list of these
channel, column : posint, or list(posint) : channel or rtable column, or list of these
compactplot : truefalse : indicates that multiple plots are to be displayed more compactly
detrend : truefalse : indicates if the data should have any trend removed
fftsize : posint : FFT window size
includepowerspectrum : truefalse or list : indicates if power spectrum is to be plotted
includesignal : truefalse or list : indicates if signal is to be plotted
reduceplot : truefalse or posint : indicates that plot resolution is to be reduced
samplerate : realcons : the sample rate
window : name or list : the name of a windowing procedure or a list containing the procedure name and additional arguments to the procedure
overlap : algebraic : the overlap between time slices
frequencyscale : anything
timeunit : anything
The Spectrogram command plots the spectrogram of one or more signals. Optionally, the amplitude of the signal and the power spectrum can be plotted along with the spectrogram. The input f can be the name of a file containing an audio signal, an rtable, or a list. See AudioTools/Formats for information about the kinds of files accepted.
If f is not an audio signal, then the samplerate option must be included. See the information about the samplerate option below.
If f is an m by n Matrix (or 2-dimensional Array), then it is assumed to contain n signals of length m. In this case, spectrograms of all signals are plotted and displayed in an array plot. Similarly, if f is an audio signal with multiple channels, then plots for all channels are produced. If you do not wish to plot all signals, the channel and column options allow you to plot a subset.
If f is a list, then every element of the list must be a single-channel audio signal or a 1-dimensional Array.
The compactplot option allows multiple plots to be displayed more compactly. When this option is set to true, it is assumed the x-axis labels for all plots are identical and thus they are displayed for the bottommost plot only.
The detrend option specifies if the data should have any linear trend removed before being plotted.
The option fftsize determines the FFT window size and its value must be a power of 2 greater than 2.
If includesignal or includesignal=true is given as an option then the original signal is also plotted. If includesignal=t, where t is a list, is given, then the signal is plotted using the contents of t as additional plotting options.
The includepowerspectrum option is similar to the includesignal option but produces a plot of the power spectrum instead.
If the signal is particularly large and the reduceplot option is set to true, then the plot resolution is automatically reduced for efficient rendering. If reduceplot is a positive integer, then the plot is reduced by that factor. The default setting for this option is true.
The samplerate option is used to specify a sample rate, in the case where one cannot be deduced. Note that audio signals generated or recognized by the AudioTools package have the sample rate saved in their attributes. If f is not such a signal, then the sample rate must be provided using this option.
The window option you to specify the windowing command. Any of the windowing commands available in the SignalProcessing package can be used. The default is SignalProcessing:-HammingWindow. A string such as "Bartlett" may be provided and is interpreted as the SignalProcessing:-BartlettWindow command in this case.
The overlap option is used to specify the overlap between time slices and must be greater or equal to 0 and less than 1. The default value is 0.
The frequencyscale option controls the scaling used on the frequency axis. The default is Hz.
The timeunit option is used to specify the unit time of the sample rate. The default value is s.
Additional plot options may be provided and are applied to the spectrogram plot. The size and axes options are also automatically applied to the signal and power spectrum plots, if they have been requested. These may be overridden by suboptions given through the includesignal and includepowerspectrum options in list form.
To change the coloring of the spectrogram, use the colorscheme option, as described on the plot/colorscheme help page.
audiofile ≔ cat⁡kernelopts⁡datadir,/audio/stereo.wav:
The SignalProcessing[Spectrogram] command was introduced in Maple 18.
For more information on Maple 18 changes, see Updates in Maple 18.
The SignalProcessing[Spectrogram] command was updated in Maple 2019.
The detrend and overlap options were introduced in Maple 2019.
For more information on Maple 2019 changes, see Updates in Maple 2019.
Download Help Document