Envelope of a spectrum, smoothing proportional to frequency.
More...
#include <SpectralEnvelope.h>
|
| void | prepare (int numBins, double widthOctaves=1.0/3.0, double minBins=1.0) |
| | Sets the bins and the width.
|
| |
| void | setWidth (double widthOctaves) noexcept |
| | Width of the smoothing in octaves (0.05 to 4; non-finite values are ignored).
|
| |
| void | setPasses (int passes) noexcept |
| | Passes of the smoothing: 1 (the default) or 2. Two passes keep the equivalent width and lose the long tails of one: the envelope follows a wide rise of the spectrum closely while a narrow line still stands over it.
|
| |
| void | setTaper (double cornerBin, double exponent) noexcept |
| | Narrows the smoothing above a corner: its width in octaves falls as (corner / frequency) to the exponent (0, the default, keeps it constant; 1 makes it constant in hertz above the corner; at most 2). Non-finite values are ignored.
|
| |
| int | getPasses () const noexcept |
| |
| double | getWidth () const noexcept |
| |
| int | getNumBins () const noexcept |
| |
| void | compute (const T *in, T *out) const noexcept |
| | The envelope of a spectrum.
|
| |
| template<int Lanes> |
| void | computeInterleaved (T *values) const noexcept |
| | The envelopes of several spectra at once, in place: each what compute() gives for its own. The recursion waits on itself at every bin, so a few run in the time of one.
|
| |
| void | resonances (const T *in, T *out) const noexcept |
| | The resonances, never negative: given decibels, the spectrum over its envelope in decibels (soft); given magnitudes, the excess of amplitude over it (hard).
|
| |
| void | excess (const T *in, T *out) const noexcept |
| | The spectrum less its envelope, with its sign (what stands over the envelope is positive, what lies under it negative).
|
| |
template<FloatType T>
class dspark::SpectralEnvelope< T >
Envelope of a spectrum, smoothing proportional to frequency.
- Template Parameters
-
| T | Sample type of the spectra (float or double). |
Definition at line 45 of file SpectralEnvelope.h.
◆ compute()
The envelope of a spectrum.
- Parameters
-
| in | numBins values (magnitudes, or decibels when logDomain). |
| out | numBins values (may be in). |
Definition at line 122 of file SpectralEnvelope.h.
◆ computeInterleaved()
template<FloatType T>
template<int Lanes>
The envelopes of several spectra at once, in place: each what compute() gives for its own. The recursion waits on itself at every bin, so a few run in the time of one.
- Template Parameters
-
| Lanes | How many spectra (1 to 8). |
- Parameters
-
| values | numBins groups of Lanes values, one of each spectrum. |
Definition at line 136 of file SpectralEnvelope.h.
◆ excess()
The spectrum less its envelope, with its sign (what stands over the envelope is positive, what lies under it negative).
- Parameters
-
| in | numBins values. |
| out | numBins values (must not be in). |
Definition at line 187 of file SpectralEnvelope.h.
◆ getNumBins()
◆ getPasses()
◆ getWidth()
◆ prepare()
Sets the bins and the width.
- Parameters
-
| numBins | Bins of the spectra (fftSize / 2 + 1), at least 2. |
| widthOctaves | Width of the smoothing, 0.05 to 4 octaves. |
| minBins | Narrowest smoothing, in bins (1 by default; a spectrum padded q times more keeps the same width in hertz with q). |
Definition at line 56 of file SpectralEnvelope.h.
◆ resonances()
The resonances, never negative: given decibels, the spectrum over its envelope in decibels (soft); given magnitudes, the excess of amplitude over it (hard).
- Parameters
-
| in | numBins values. |
| out | numBins values of the excess (must not be in). |
Definition at line 175 of file SpectralEnvelope.h.
◆ setPasses()
Passes of the smoothing: 1 (the default) or 2. Two passes keep the equivalent width and lose the long tails of one: the envelope follows a wide rise of the spectrum closely while a narrow line still stands over it.
Definition at line 90 of file SpectralEnvelope.h.
◆ setTaper()
Narrows the smoothing above a corner: its width in octaves falls as (corner / frequency) to the exponent (0, the default, keeps it constant; 1 makes it constant in hertz above the corner; at most 2). Non-finite values are ignored.
- Parameters
-
| cornerBin | The corner, in bins. |
| exponent | 0 to 2. |
Definition at line 104 of file SpectralEnvelope.h.
◆ setWidth()
Width of the smoothing in octaves (0.05 to 4; non-finite values are ignored).
Definition at line 65 of file SpectralEnvelope.h.
The documentation for this class was generated from the following file: