|
DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
|
A part of a DetailFilter: minimum-phase kernels designed as a SpectralFilter designs its own (detail::MinimumPhase), at the window and padding given, convolved in partitions of a block (a quarter of that window, up to the whole of it). More...
#include <DetailFilter.h>
Public Types | |
| using | S = std::conditional_t< L==DetailLatency::Block, double, T > |
| What the signal runs in: double by the block, where it costs little; T by the frame. | |
Public Member Functions | |
| void | prepare (double sampleRate, int channels, int window, int padding, int block, int steps) |
| Allocates. | |
| void | reset () noexcept |
| Clears the signal and the kernels (every one is then flat). | |
| void | setLinked (bool on) noexcept |
| One kernel for every channel. | |
| void | setShortKernel (bool on) noexcept |
| Kernels a window long, tapered over their whole length, from the next one designed. | |
| int | getLatency () const noexcept |
| int | getHopSize () const noexcept |
| int | getNumBins () const noexcept |
| int | getTransformSize () const noexcept |
| int | getKernelLength () const noexcept |
| double | getBinHz () const noexcept |
| const double * | getKeptKernel (int channel) const noexcept |
| template<typename Design > | |
| void | processBlock (AudioBufferView< T > buffer, Design &&design) noexcept |
| Filters a block in place. | |
A part of a DetailFilter: minimum-phase kernels designed as a SpectralFilter designs its own (detail::MinimumPhase), at the window and padding given, convolved in partitions of a block (a quarter of that window, up to the whole of it).
A kernel is designed every steps blocks. With DetailLatency::Frame the output runs through the last four as Hann frames four spacings long and one apart would play them. Their weights pair up (the first and the third add up to a half, as do the other two), so three convolutions play four kernels: their mean and the two differences. With DetailLatency::Block it runs through the last three by a quadratic B-spline. A fade between two images a moving curve at the rate of the kernels: by its first power near that rate with a raised cosine, by its square with a straight line, which then falls slowly away from it. The spline images by the cube and has no corner. Kernels are designed in double; the signal runs in double by the block (where it leaves the products of float rounding 20 dB lower for a tenth more of the cost) and in T by the frame. A flat curve returns the input to the bit, late by a block.
Audio thread, except prepare() (setup thread; allocates).
| T | Sample type (float or double). |
| L | How the output runs through the kernels. |
Definition at line 157 of file DetailFilter.h.
| using dspark::detail::KernelConvolver< T, L >::S = std::conditional_t<L == DetailLatency::Block, double, T> |
What the signal runs in: double by the block, where it costs little; T by the frame.
Definition at line 161 of file DetailFilter.h.
|
inlinenoexcept |
Definition at line 263 of file DetailFilter.h.
|
inlinenoexcept |
Definition at line 255 of file DetailFilter.h.
|
inlinenoexcept |
Definition at line 265 of file DetailFilter.h.
|
inlinenoexcept |
Definition at line 261 of file DetailFilter.h.
|
inlinenoexcept |
Definition at line 253 of file DetailFilter.h.
|
inlinenoexcept |
Definition at line 257 of file DetailFilter.h.
|
inlinenoexcept |
Definition at line 259 of file DetailFilter.h.
|
inline |
Allocates.
| sampleRate | The rate this part runs at. |
| channels | The channels it filters. |
| window | The window the curve is designed for (a power of two, 4 at least). |
| padding | The transform of the design over that window (a power of two). |
| block | Samples of a partition: a quarter of the window to all of it. |
| steps | Blocks from one kernel to the next. |
Definition at line 172 of file DetailFilter.h.
|
inlinenoexcept |
Filters a block in place.
| Design | void(int channel, const T* power, T* logGain, int bins): writes natural logarithms of gains (preset to 0). The power is nullptr and the channel -1 when linked. Must not throw. |
| buffer | The audio. |
| design | The callback, run as each kernel starts. |
Definition at line 281 of file DetailFilter.h.
|
inlinenoexcept |
Clears the signal and the kernels (every one is then flat).
Definition at line 233 of file DetailFilter.h.
|
inlinenoexcept |
One kernel for every channel.
Definition at line 248 of file DetailFilter.h.
|
inlinenoexcept |
Kernels a window long, tapered over their whole length, from the next one designed.
Definition at line 250 of file DetailFilter.h.