Auditory Spectrogram
Libraries:
Audio Toolbox /
Features
Description
The Auditory Spectrogram block extracts a spectrogram from the audio input signal. A spectrogram contains an estimate of the short-term, time-localized frequency content of the input signal.
Examples
Extract GTCC from Audio in Simulink
Extract gammatone cepstral coefficients and their delta features in Simulink®.
Ports
Input
Port_1 — Audio input
column vector | matrix
Audio input signal, specified as a column vector or a matrix. When you specify a matrix, the block treats columns as independent audio channels.
Data Types: single
| double
Output
spec — Spectrogram
matrix | 3-D array
Spectrogram, returned as a matrix or 3-D array. The dimensions of spec are L-by-M-by-N, where:
L is the number of spectra, which is determined by the Number of spectra parameter.
M is the number of bands, which is determined by the Auto-determine number of bands and Number of bands parameters.
N is the number of channels in the input audio signal.
Trailing singleton dimensions are removed from the output.
This port is unnamed until you select the Output center frequencies parameter.
Data Types: single
| double
fvec — Center frequencies
row vector
Center frequencies of the bandpass filters in Hz, returned as a row vector with number of elements equal to the number of bands.
Dependencies
To enable this port, select the Output center frequencies parameter.
Data Types: single
| double
Parameters
Frequency scale — Frequency scale of filter bank
mel
(default) | bark
| erb
Frequency scale used to design the auditory filter bank, specified as
mel
, bark
, or
erb
.
mel
–– Design the filter bank as half-overlapped triangles equally spaced on the mel scale.bark
–– Design the filter bank as half-overlapped triangles equally spaced on the Bark scale.erb
–– Design the filter bank as gammatone filters whose center frequencies are equally spaced on the ERB scale.
Mel style — Mel style
oshaughnessy
(default) | slaney
Style of the mel scale, specified as oshaughnessy
or
slaney
.
Dependencies
To enable this parameter, set the Frequency scale
parameter to mel
.
Auto-determine number of bands — Automatically determine number of bandpass filters
on
(default) | off
When you select this parameter, the block automatically determines the number of bandpass filters based on the Frequency scale parameter.
Number of bands — Number of bandpass filters
32
(default) | positive integer
Number of bandpass filters, specified as a positive integer.
Dependencies
To enable this parameter, clear the Auto-determine number of bands parameter.
Auto-determine frequency range — Automatically determine frequency range
on
(default) | off
When you select this parameter, the block sets the Frequency range
to [0,fs/2]
, where fs
is the sample
rate. The sample rate is determined by the Inherit sample rate
from input and Input sample rate (Hz)
parameters.
Frequency range (Hz) — Frequency range over which to design auditory filter bank
[0,22050]
(default) | two-element row vector
Frequency range in Hz over which to design the auditory filter bank, specified as a two-element row vector.
Dependencies
To enable this parameter, clear the Auto-determine frequency range parameter.
Filter bank design domain — Domain to design filter bank
linear
(default) | warped
Domain in which the block designs the filter bank, specified as
linear
or warped
.
Set the filter bank design domain to linear
to
design the bandpass filters in the linear (Hz) domain. Set the filter bank
design domain to warped
to design the bandpass
filters in the warped (mel or Bark) domain.
Dependencies
To enable this parameter, set Frequency scale to
mel
or
bark
.
Filter bank normalization — Normalization technique for filter bank
bandwidth
(default) | area
| none
Normalization technique used for the filter bank weights, specified as
bandwidth
, area
,
or none
.
bandwidth
–– Normalize the weights of each bandpass filter by the corresponding bandwidth of the filter.area
–– Normalize the weights of each bandpass filter by the corresponding area of the bandpass filter.none
–– The block does not normalize the weights of the filters.
Output center frequencies — Specify additional output port for center frequencies
off
(default) | on
When you select this parameter, the block displays an additional output port, fvec. This port outputs the center frequencies of the bandpass filters.
Visualize filter bank — Open plot to visualize filter bank
button
Open plot to visualize the filters in the frequency domain.
Window — Analysis window
hamming(1024,'periodic')
(default) | real vector
Analysis window applied in the time domain, specified as a real vector.
Normalize window — Normalize analysis window
on
(default) | off
When you select this parameter, the block applies window normalization.
Overlap length — Overlap length of adjacent analysis windows
512
(default) | integer in the range [0, windowLength
)
Overlap length of adjacent analysis windows, specified as an integer in
the range [0, windowLength
), where
windowLength
is the length of the analysis window,
which is specified by Window.
Auto-determine FFT length — Automatically determine FFT length
on
(default) | off
When you select this parameter, the block automatically sets the FFT length to the window
length numel(Window)
.
FFT length — Number of DFT points
1024
(default) | positive integer
Number of points used to calculate the DFT, specified as a positive integer.
Dependencies
To enable this parameter, clear the Auto-determine FFT length parameter.
Spectrum type — Type of spectrum
magnitude
(default) | power
Type of spectrum, specified as magnitude
or
power
.
Number of spectra — Number of spectra
1
(default) | positive integer
Number of spectra in the spectrogram, specified as a positive integer.
Number of spectra overlap — Number of overlapped spectra
0
(default) | integer in the range [0, Number of spectra)
Number of spectra overlapped across consecutive spectrograms, specified as an integer in the range [0, Number of spectra).
Apply logarithm — Apply logarithm
off
(default) | on
When you select this parameter, the block applies a base 10 logarithm to the spectrogram.
Inherit sample rate from input — Specify source of input sample rate
off
(default) | on
When you select this parameter, the block inherits its sample rate from the input signal. When you clear this parameter, you specify the sample rate in the Input sample rate (Hz) parameter.
Input sample rate (Hz) — Sample rate of input
44.1e3
(default) | positive scalar
Input sample rate in Hz, specified as a real positive scalar.
Dependencies
To enable this parameter, clear the Inherit sample rate from input parameter.
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
The Auditory Spectrogram block supports optimized code generation using single instruction, multiple data (SIMD) instructions. For more information about SIMD code generation, see Generate SIMD Code from Simulink Blocks for Intel Platforms (Simulink Coder).
Version History
Introduced in R2022aR2024a: Apply logarithm to spectrogram
Select the Apply logarithm parameter to apply a base 10 logarithm to the spectrogram.
R2023b: Support for Slaney-style mel scale
Set the Mel style parameter to
slaney
to use the Slaney-style mel scale.
R2023a: Generate optimized C/C++ code for computing auditory spectrogram
The Auditory Spectrogram block supports optimized C/C++ code generation using single instruction, multiple data (SIMD) instructions.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)