Octave Filter
Octave-band and fractional octave-band filter
Libraries:
Audio Toolbox /
Filters
Description
The Octave Filter block performs octave-band or fractional octave-band filtering independently across each input channel. An octave-band is a frequency band where the highest frequency is twice the lowest frequency. Octave-band and fractional octave-band filters are commonly used to mimic how humans perceive loudness. Octave filters are best understood when viewed on a logarithmic scale, which models how the human ear weights the spectrum.
Examples
Perform Octave Filtering
Examine the Octave Filter block in a Simulink® model and tune parameters.
Tune Center Frequency Using Input Port
Tune the center frequency of an Octave Filter block in Simulink® using the optional input port.
Ports
Input
x — Input signal
matrix | 1-D vector
Matrix input –– Each column of the input is treated as an independent channel.
1-D vector input –– The input is treated as a single channel.
This port is unnamed unless you specify additional input ports.
Data Types: single
| double
CF — Center frequency (Hz)
scalar in the range 3
to 22,000
inclusive
Dependencies
To enable this port, select Specify from input port for the Center frequency (Hz) parameter.
Data Types: single
| double
Output
Port_1 — Output signal
matrix
The Octave Filter block outputs a signal with the same data type as the input signal. The size of the output depends on the size of the input:
Matrix input –– The block outputs a matrix the same size and data type as the input signal.
1-D vector input –– The block outputs an N-by-1 matrix (column vector), where N is the number of elements in the 1-D vector.
Data Types: single
| double
Parameters
If a parameter is listed as tunable, then you can change its value during simulation.
Filter order — Order of octave filter
6
(default) | even integer
Tunable: No
Center frequency (Hz) — Center frequency of octave filter
1000
(default) | scalar in the range 3
to 22,000
inclusive
The maximum center frequency is the value that causes the upper band edge to be equal to the Nyquist frequency, Fs/2. Frequencies above this value are saturated.
The minimum center frequency is the value that causes the lower band edge to be equal to 1 Hz. Frequencies below this value are quantized to 1 Hz.
To specify Center frequency (Hz) from an input port, select Specify from input port for the parameter.
Tunable: Yes
Bandwidth — Filter bandwidth in octaves
1 octave
(default) | 2/3 octave
| 1/2 octave
| 1/3 octave
| 1/6 octave
| 1/12 octave
| 1/24 octave
| 1/48 octave
Tunable: Yes
Oversample the input by 2 for this filter — Oversample toggle
off (default) | on
off –– The Octave Filter block runs at the input sample rate.
on –– The Octave Filter block runs at two times the input sample rate. Oversampling minimizes the frequency warping effects introduced by the bilinear transformation. An FIR halfband interpolator implements oversampling before octave filtering. A halfband decimator reduces the sample rate back the input sampling rate after octave filtering.
Tunable: No
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 Input sample rate (Hz).
Tunable: No
Input sample rate (Hz) — Sample rate of input
44100
(default) | scalar
Tunable: Yes
Dependencies
To enable this parameter, clear the Inherit sample rate from input parameter.
Simulate using — Specify type of simulation to run
Code generation
(default) | Interpreted execution
Code generation
–– Simulate the model using generated C code. The first time you run a simulation, Simulink® generates C code for the block. The C code is reused for subsequent simulations as long as the model does not change. This option requires additional startup time, but the speed of the subsequent simulations is comparable toInterpreted execution
.Interpreted execution
–– Simulate the model using the MATLAB® interpreter. This option shortens startup time but has a slower simulation speed thanCode generation
. In this mode, you can debug the source code of the block.
Tunable: No
Mask for attenuation limits — Create a mask for filter response visualization
No mask
(default) | Class 0
| Class 1
| Class 2
The mask attenuation limits are defined in the ANSI S1.11-2004 standard.
If the mask is green, the design is compliant.
If the mask is red, the design breaks compliance.
Tunable: Yes
Visualize filter response — Open plot to visualize magnitude response and compliance mask
button
A 2048-point FFT is used to calculate the magnitude response.
Tunable: Yes
Variable name — Variable name of exported filter
myFilt
(default) | valid variable name
Name of the variable in the base workspace to contain the filter when it is exported. The name must be a valid MATLAB variable name.
Overwrite variable if it already exists — Overwrite variable if it already exists
on
(default) | off
When you select this parameter, exporting the filter overwrites the
variable specified by the Variable name parameter if it
already exists in the base workspace. If you do not select this parameter
and the specified variable already exists in the workspace, exporting the
filter creates a new variable with an underscore and a number appended to
the variable name. For example, if the variable name is
var
and it already exists, the exported variable will
be named var_1
.
Export filter to workspace — Export filter to workspace
button
Export the filter to the base workspace in the variable specified by the Variable name parameter.
Tips
You cannot export the filter if you have enabled the Inherit sample rate from input parameter and the model is not running.
You cannot export the filter if you are specifying filter characteristics from input ports.
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
More About
Band Edge
A band edge frequency refers to the lower or upper edge of the passband of a bandpass filter.
Center Frequency of Octave Filter
The center frequency of an octave filter is the geometric mean of the lower- and upper-band edge frequencies.
Algorithms
Octave Bandwidth to Band Edge Conversion
The Octave Filter block uses the specified center frequency and filter bandwidth in octaves to determine the band edges [2].
First the block computes the upper and lower band edge frequencies:
fc is the center frequency specified by the Center frequency (Hz) parameter.
b is the octave bandwidth specified by the Bandwidth parameter. For example, if Bandwidth is specified as
1/3 octave
, the value of b is 3.G is a conversion constant:
Digital Filter Design
The Octave Filter block implements a higher-order digital bandpass filter design method as specified in [1].
In this design method, a desired digital bandpass filter maps to a Butterworth lowpass analog prototype, which is then mapped back to a digital bandpass filter:
The analog Butterworth filter is expressed as a cascade of second-order sections:
N is the filter order specified by the Filter order parameter.
The analog Butterworth filter is mapped to a digital filter using a bandpass version of the bilinear transformation:
where
This mapping results in the following substitution:
The analog prototype is evaluated:
Because s is second-order in z, the bandpass version of the bilinear transformation is fourth-order in z.
References
[1] Orfanidis, Sophocles J. Introduction to Signal Processing. Englewood Cliffs, NJ: Prentice Hall, 2010.
[2] Acoustical Society of America. American National Standard Specification for Octave-Band and Fractional-Octave-Band Analog and Digital Filters: ANSI S1.11-2004. Melville, NY: Acoustical Society of America, 2009.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2016b
See Also
octaveFilter
| weightingFilter
| Weighting Filter | Octave Filter
Bank
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 (한국어)