|
DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
|
Minimum-phase filtering by a gain curve designed every hop. More...
#include <SpectralFilter.h>
Public Member Functions | |
| void | prepare (const AudioSpec &spec, int windowSize=2048, int padding=2, int overlap=4) |
| Allocates for a layout. | |
| void | setLinked (bool on) noexcept |
| One filter for every channel, designed on their mean power. | |
| bool | isLinked () const noexcept |
| void | setRemovalListen (bool on) noexcept |
| Applies one minus the filter (what it takes out). | |
| bool | isRemovalListen () const noexcept |
| void | setShortKernel (bool on) noexcept |
| Cuts the filter's impulse response to half the transform and tapers it over its whole length (off by default: the response keeps the room the padding leaves, with only its tail tapered). A cut then rings for a shorter time after the event: of the response of a cut of 24 dB at a window of 1024, the energy past half a window falls from -33 to -43 dB, at the same depth. | |
| bool | isShortKernel () const noexcept |
| void | setTimeFocus (bool on) noexcept |
| Gives the design each bin's power through a stretch of the window of its own, shorter as frequency rises (SpectralFocus; off by default: the whole window at every frequency). The filter itself is applied as before. A noise reads the same (within 0.1 dB by octaves, padding included); a tone that starts at the top shows whole from one frame to the next, where the whole window shows part of it for a frame; a held tone stands less above what surrounds it. | |
| bool | isTimeFocus () const noexcept |
| void | setTimeFocusWidth (double octaves) noexcept |
| The width the focus smooths the spectrum by, 1/24 to 1 octave (1/6 by default). Read at prepare(). | |
| double | getTimeFocusWidth () const noexcept |
| int | getLatency () const noexcept |
| int | getWindowSize () const noexcept |
| int | getTransformSize () const noexcept |
| int | getHopSize () const noexcept |
| int | getNumBins () const noexcept |
| double | getBinHz () const noexcept |
| double | getSampleRate () const noexcept |
| const T * | getFramePower (int channel) const noexcept |
| void | reset () noexcept |
| Clears the input, the output and the hop phase. | |
| template<typename Design > | |
| void | processBlock (AudioBufferView< T > buffer, Design &&design) noexcept |
| Filters a block in place. | |
| template<typename Design > | |
| void | processBlock (AudioBufferView< T > buffer, const AudioBufferView< T > *key, Design &&design) noexcept |
| Filters a block in place, the callback reading the power of a key (the same length or longer; its last channel serves the programme's extra ones; nullptr, or the programme's own channels, reads the programme with no second transform). | |
Static Public Attributes | |
| static constexpr int | kMinWindow = 64 |
| Shortest analysis window. | |
| static constexpr int | kMaxWindow = 32768 |
| Longest analysis window. | |
Minimum-phase filtering by a gain curve designed every hop.
| T | Sample type (float or double); the transforms run in double. |
Definition at line 125 of file SpectralFilter.h.
|
inlinenoexcept |
Definition at line 233 of file SpectralFilter.h.
|
inlinenoexcept |
Definition at line 241 of file SpectralFilter.h.
|
inlinenoexcept |
Definition at line 231 of file SpectralFilter.h.
|
inlinenoexcept |
Definition at line 228 of file SpectralFilter.h.
|
inlinenoexcept |
Definition at line 232 of file SpectralFilter.h.
|
inlinenoexcept |
Definition at line 234 of file SpectralFilter.h.
|
inlinenoexcept |
Definition at line 226 of file SpectralFilter.h.
|
inlinenoexcept |
Definition at line 230 of file SpectralFilter.h.
|
inlinenoexcept |
Definition at line 229 of file SpectralFilter.h.
|
inlinenoexcept |
Definition at line 191 of file SpectralFilter.h.
|
inlinenoexcept |
Definition at line 194 of file SpectralFilter.h.
|
inlinenoexcept |
Definition at line 204 of file SpectralFilter.h.
|
inlinenoexcept |
Definition at line 217 of file SpectralFilter.h.
|
inline |
Allocates for a layout.
| spec | Rate and channels (an invalid spec is ignored). |
| windowSize | Analysis window, rounded up to a power of two (64 to 32768). |
| padding | Transform over window: 2, 4 or 8 (others are rounded down). |
| overlap | Frames per window: 2 to 16 (rounded down to a power of two). |
Definition at line 138 of file SpectralFilter.h.
|
inlinenoexcept |
Filters a block in place, the callback reading the power of a key (the same length or longer; its last channel serves the programme's extra ones; nullptr, or the programme's own channels, reads the programme with no second transform).
Definition at line 278 of file SpectralFilter.h.
|
inlinenoexcept |
Filters a block in place.
| Design | void(int channel, const T* power, T* gain, int numBins): reads the power of each bin of the frame (a full-scale sine reads about 1 in its bin) and writes the gain wanted there (linear, preset to 1; a gain under -120 dB is taken as -120). The channel is -1 when linked. Must not throw. |
Definition at line 266 of file SpectralFilter.h.
|
inlinenoexcept |
Clears the input, the output and the hop phase.
Definition at line 247 of file SpectralFilter.h.
|
inlinenoexcept |
One filter for every channel, designed on their mean power.
Definition at line 190 of file SpectralFilter.h.
|
inlinenoexcept |
Applies one minus the filter (what it takes out).
Definition at line 193 of file SpectralFilter.h.
|
inlinenoexcept |
Cuts the filter's impulse response to half the transform and tapers it over its whole length (off by default: the response keeps the room the padding leaves, with only its tail tapered). A cut then rings for a shorter time after the event: of the response of a cut of 24 dB at a window of 1024, the energy past half a window falls from -33 to -43 dB, at the same depth.
Definition at line 203 of file SpectralFilter.h.
|
inlinenoexcept |
Gives the design each bin's power through a stretch of the window of its own, shorter as frequency rises (SpectralFocus; off by default: the whole window at every frequency). The filter itself is applied as before. A noise reads the same (within 0.1 dB by octaves, padding included); a tone that starts at the top shows whole from one frame to the next, where the whole window shows part of it for a frame; a held tone stands less above what surrounds it.
Definition at line 216 of file SpectralFilter.h.
|
inlinenoexcept |
The width the focus smooths the spectrum by, 1/24 to 1 octave (1/6 by default). Read at prepare().
Definition at line 222 of file SpectralFilter.h.
|
staticconstexpr |
Longest analysis window.
Definition at line 129 of file SpectralFilter.h.
|
staticconstexpr |
Shortest analysis window.
Definition at line 128 of file SpectralFilter.h.