|
DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
|
Learn-a-profile spectral noise reduction (hiss/hum/room-tone). More...
#include <SpectralDenoiser.h>
Public Member Functions | |
| void | prepare (const AudioSpec &spec, int fftSize=2048) |
| Prepares the STFT pipeline and the per-channel bin state. | |
| void | reset () noexcept |
| Clears signal state and per-bin gain memories (keeps profile). | |
| void | clearProfile () noexcept |
| Forgets the learned noise profile (stream-owner thread). | |
| void | setLearning (bool learning) noexcept |
| While true, incoming audio trains the noise profile. | |
| void | setReduction (T db) noexcept |
| Maximum attenuation of noise bins in dB [0, 40] (default 18): the floor of the per-bin gain. Non-finite values are ignored. | |
| void | setThreshold (T factor) noexcept |
| Noise over-subtraction factor over the learned profile, in magnitude [1, 8] (default 2): the gain rule sees the learned noise scaled by it, so higher values remove more noise and more low-level signal. Non-finite values are ignored. | |
| void | setDetail (T octaves) noexcept |
| The detail: the band, in octaves, in which the signal and the noise are read at each bin, from 1 (broad, the steadiest residual) down to 0 (default: each bin by itself, the finest there is, between the partials of a note). A band is never narrower than a bin. It moves while playing, at the same latency, and the profile learned holds at any detail. | |
| void | setGainRelease (T ms) noexcept |
| Release of each bin's gain at 1 kHz, 0 (off, default) to 2000 ms; slower below, faster above. | |
| void | setSensitivityBand (int index, const typename KeyEqualizer< T, 2 >::Band &band) noexcept |
| One band of the sensitivity curve: the reduction is scaled by its gain in dB / 12 + 1, clamped 0 to 2. | |
| KeyEqualizer< T, 2 >::Band | getSensitivityBand (int index) const noexcept |
| void | setRemovalListen (bool on) noexcept |
| Outputs what is taken out instead of what is kept. | |
| void | setFilterMode (bool on) noexcept |
| Spreads no further ahead of an attack than one short frame of 5 ms (see the file comment): the default path, with those frames where an attack is ahead and for 11 ms after it. The latency is the same, and it can be switched while playing. | |
| void | setLink (T amount) noexcept |
| In filter mode, how far the power each channel is read by goes to the mean of the pair, 0 (each its own, default) to 1 (one detector and one filter). | |
| T | getDetail () const noexcept |
| T | getDisplayGain (int point) const noexcept |
| T | getGainRelease () const noexcept |
| bool | getRemovalListen () const noexcept |
| bool | getFilterMode () const noexcept |
| T | getLink () const noexcept |
| bool | getLearning () const noexcept |
| T | getReduction () const noexcept |
| T | getThreshold () const noexcept |
| int | getLatency () const noexcept |
| Latency in samples (the STFT pipeline's); 0 before prepare() succeeds, while the instance passes audio through. | |
| std::vector< uint8_t > | getState () const |
| Serializes the parameter state (the learned profile is material- dependent content, not a preset, and is intentionally not included). | |
| bool | setState (const uint8_t *data, size_t size) |
| Restores parameters from a blob (tolerant; rejects foreign ids). The smoothing of the first version, which was in bins, becomes the band as wide at 1 kHz. | |
| void | processBlock (AudioBufferView< T > buffer) noexcept |
| Processes a block in-place. Pass-through until prepare() succeeds. | |
Static Public Member Functions | |
| static double | getDisplayFrequency (int point) noexcept |
Static Public Attributes | |
| static constexpr int | kDisplayPoints = SpectralReadout<T>::kPoints |
| Points of the display curve, evenly in log frequency from 20 Hz to 20 kHz. | |
Learn-a-profile spectral noise reduction (hiss/hum/room-tone).
| T | Sample type (float or double). |
Definition at line 100 of file SpectralDenoiser.h.
|
inlinenoexcept |
Forgets the learned noise profile (stream-owner thread).
Definition at line 187 of file SpectralDenoiser.h.
|
inlinenoexcept |
Definition at line 265 of file SpectralDenoiser.h.
|
inlinestaticnoexcept |
Definition at line 269 of file SpectralDenoiser.h.
|
inlinenoexcept |
Definition at line 271 of file SpectralDenoiser.h.
|
inlinenoexcept |
Definition at line 277 of file SpectralDenoiser.h.
|
inlinenoexcept |
Definition at line 275 of file SpectralDenoiser.h.
|
inlinenoexcept |
Latency in samples (the STFT pipeline's); 0 before prepare() succeeds, while the instance passes audio through.
Definition at line 286 of file SpectralDenoiser.h.
|
inlinenoexcept |
Definition at line 280 of file SpectralDenoiser.h.
|
inlinenoexcept |
Definition at line 278 of file SpectralDenoiser.h.
|
inlinenoexcept |
Definition at line 281 of file SpectralDenoiser.h.
|
inlinenoexcept |
Definition at line 276 of file SpectralDenoiser.h.
|
inlinenoexcept |
Definition at line 247 of file SpectralDenoiser.h.
|
inline |
Serializes the parameter state (the learned profile is material- dependent content, not a preset, and is intentionally not included).
Definition at line 293 of file SpectralDenoiser.h.
|
inlinenoexcept |
Definition at line 282 of file SpectralDenoiser.h.
|
inline |
Prepares the STFT pipeline and the per-channel bin state.
Invalid specs (non-positive/non-finite rate, block size or channel count) are ignored: the previous state is kept and an unprepared instance stays pass-through. fftSize is sanitized by the STFT engine (power of two in [4, 1 << 20]).
| spec | Audio environment specification. |
| fftSize | STFT size (default 2048; larger = finer hum notching; 0 = by the rate: 2048 at 44.1 and 48 kHz, doubling by octaves). One over the rate's own runs its frames a sixteenth of it apart in place of a quarter, at some four times the cost: a quarter apart, gains that differ from bin to bin leave images of a line between the lines. |
Definition at line 121 of file SpectralDenoiser.h.
|
inlinenoexcept |
Processes a block in-place. Pass-through until prepare() succeeds.
Definition at line 338 of file SpectralDenoiser.h.
|
inlinenoexcept |
Clears signal state and per-bin gain memories (keeps profile).
Definition at line 172 of file SpectralDenoiser.h.
|
inlinenoexcept |
The detail: the band, in octaves, in which the signal and the noise are read at each bin, from 1 (broad, the steadiest residual) down to 0 (default: each bin by itself, the finest there is, between the partials of a note). A band is never narrower than a bin. It moves while playing, at the same latency, and the profile learned holds at any detail.
Definition at line 229 of file SpectralDenoiser.h.
|
inlinenoexcept |
Spreads no further ahead of an attack than one short frame of 5 ms (see the file comment): the default path, with those frames where an attack is ahead and for 11 ms after it. The latency is the same, and it can be switched while playing.
Definition at line 256 of file SpectralDenoiser.h.
|
inlinenoexcept |
Release of each bin's gain at 1 kHz, 0 (off, default) to 2000 ms; slower below, faster above.
Definition at line 235 of file SpectralDenoiser.h.
|
inlinenoexcept |
While true, incoming audio trains the noise profile.
Definition at line 198 of file SpectralDenoiser.h.
|
inlinenoexcept |
In filter mode, how far the power each channel is read by goes to the mean of the pair, 0 (each its own, default) to 1 (one detector and one filter).
Definition at line 258 of file SpectralDenoiser.h.
|
inlinenoexcept |
Maximum attenuation of noise bins in dB [0, 40] (default 18): the floor of the per-bin gain. Non-finite values are ignored.
Definition at line 205 of file SpectralDenoiser.h.
|
inlinenoexcept |
Outputs what is taken out instead of what is kept.
Definition at line 249 of file SpectralDenoiser.h.
|
inlinenoexcept |
One band of the sensitivity curve: the reduction is scaled by its gain in dB / 12 + 1, clamped 0 to 2.
Definition at line 241 of file SpectralDenoiser.h.
|
inline |
Restores parameters from a blob (tolerant; rejects foreign ids). The smoothing of the first version, which was in bins, becomes the band as wide at 1 kHz.
Definition at line 313 of file SpectralDenoiser.h.
|
inlinenoexcept |
Noise over-subtraction factor over the learned profile, in magnitude [1, 8] (default 2): the gain rule sees the learned noise scaled by it, so higher values remove more noise and more low-level signal. Non-finite values are ignored.
Definition at line 215 of file SpectralDenoiser.h.
|
staticconstexpr |
Points of the display curve, evenly in log frequency from 20 Hz to 20 kHz.
Definition at line 267 of file SpectralDenoiser.h.