|
DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
|
Dynamic suppression of resonances by a minimum-phase filter on a log-frequency grid. More...
#include <ResonanceSuppressor.h>
Public Types | |
| enum class | Mode { Smooth , Deep } |
| enum class | Link { PerBin , MidSide } |
| enum class | Quality { Realtime , Offline } |
| using | Band = typename KeyEqualizer< T, 2 >::Band |
Public Member Functions | |
| void | prepare (const AudioSpec &spec) |
| Allocates for a rate and a layout (an invalid spec is ignored). | |
| void | reset () noexcept |
| Clears the analysis and the filter. | |
| void | setDetail (T octaves) noexcept |
| The detail: how narrow what is found and cut is, from an octave to 1/24 of one (default 1/12). It moves while playing, at the same latency. | |
| void | setThreshold (T db) noexcept |
| Over the loudest of its neighbours by this much a peak is a resonance, 0 to 30 dB (default 5). | |
| void | setStrength (T amount) noexcept |
| How much of what passes the threshold is taken out, 0 to 1 (default 1). | |
| void | setRange (T db) noexcept |
| Largest reduction, 0 to 48 dB (default 9; Mode::Deep reaches half as far again). | |
| void | setWidth (T octaves) noexcept |
| How far the neighbours a peak is compared with reach, in octaves beyond the detail, 0.05 to 4 (default 1/3). A side with no peak that near is read on to the next partial of a note. | |
| void | setAttack (T ms) noexcept |
| Attack at 1 kHz, 0.5 to 500 ms (default 5; slower below, faster above, by the square root of the frequency). | |
| void | setRelease (T ms) noexcept |
| Release at 1 kHz, 5 to 2000 ms (default 80). | |
| void | setMode (Mode m) noexcept |
| Smooth (the default) works at the detail set and takes what stands over the loudest of its neighbours. Deep is more of both, detail and strength: it reads and cuts in half the detail (to 1/24 of an octave at the finest), takes both of two resonances closer than the detail and what stands over the mean of its peers, and takes up to half as deep again, setRange() included (under about 150 Hz no narrower, and as little as a fifth deeper). | |
| void | setFoundationGuard (T amount) noexcept |
| How far what carries the programme from under it is spared, 0 to 1 (default 1): what is within 6 dB of the loudest with nothing within 20 dB underneath, like a sub bass, is then not taken under 70 Hz and by more as it rises, whole from 320 Hz. At 0 it is a resonance like any other, as deep in the low end as at the top. The same in both modes. Non-finite values are ignored. | |
| void | setLinkMode (Link l) noexcept |
| Stereo handling (PerBin by default). | |
| void | setLink (T amount) noexcept |
| Per-point link, 0 (each channel its own) to 1 (one detector and filter), default 1. | |
| void | setSideWeight (T share) noexcept |
| In MidSide, the side's reduction as a share of the mid's, 0 to 2 (default 1). | |
| void | setRemovalListen (bool on) noexcept |
| Outputs what is taken out. | |
| void | setFocusListen (bool on) noexcept |
| Outputs the programme through the sensitivity curve. | |
| void | setMix (T amount) noexcept |
| How much of the filter is applied, 0 to 1 (default 1). The mix is taken inside the filter: its gain becomes 1 - mix + mix * gain before the minimum-phase filter is designed, so the part left alone and the part reduced never meet in two phases. | |
| void | setKnee (T db) noexcept |
| Soft knee at the threshold, 0 to 12 dB (0, the default, is the hard knee): the reduction grows smoothly on both sides of the threshold, so a resonance that hovers at it moves less from frame to frame. | |
| void | setPersistence (T ms) noexcept |
| Persistence, 0 to 500 ms (default 50; 0 counts at once): how long a resonance lasts before it counts, not at all until half of it has gone by and whole half of it later, however loud. A click, a consonant or the attack of a drum are over before they weigh. | |
| void | setQuietLevel (T dbfs) noexcept |
| Level under which the suppressor lets go, -120 to 0 dBFS (off at -200, the default; anything under -190 turns it off). Each point is read as its amplitude plus this level, so what lies well over it is treated as before and what lies under it shows no resonance: quiet passages, tails and the noise of a room are left alone. | |
| void | setAuditoryWeighting (bool on) noexcept |
| Weighs the amount by how well the ear hears each frequency (off by default): a third of the distance in dB from the threshold of hearing in quiet to its lowest point comes off the weight, so the same excess weighs at 150 Hz under half of what it does at 3 kHz. | |
| void | setWidthTaper (T cornerHz, T exponent) noexcept |
| Narrows setWidth() above a corner: it falls as (corner / frequency) to the exponent (0, the default, keeps it everywhere; 1 keeps it constant in hertz above the corner). Non-finite values are ignored. | |
| void | setRemovalBand (T lowHz, T highHz) noexcept |
| The band setRemovalListen() plays, in hertz (0 and 0, the default, play all of it): what is taken out between the two frequencies alone, with a sixth of an octave of slope at each end. A listening aid like the listen itself: not part of the state. Non-finite values are ignored. | |
| void | setQuality (Quality q) noexcept |
| Realtime reads the long windows of the low end in turns, every two or four hops; Offline reads all of them every hop, for a render (applies at the next prepare(); the same latency). | |
| void | setQualityFollowsRender (bool on) noexcept |
| With it on, a prepare() made while the host renders offline takes the Offline quality whatever setQuality() says (off by default): a bounce is made at the best quality with no setting to remember. The latency is the same in both. | |
| void | setOfflineRendering (bool on) noexcept |
| Tells the suppressor whether the host renders offline (read by the next prepare(); a plugin forwards its host's notice here before it prepares). | |
| void | setSensitivityBand (int index, const Band &band) noexcept |
| One band of the sensitivity curve (KeyEqualizer bands; the curve is a weight, its gain in dB / 12 + 1, clamped 0 to 2). | |
| T | getDetail () const noexcept |
| void | setShortKernel (bool on) noexcept |
| Plays kernels of half their transform, tapered over their whole length (off by default; see DetailFilter::setShortKernel()): a cut rings for a shorter time after the event, at the same depth. | |
| bool | getShortKernel () const noexcept |
| T | getThreshold () const noexcept |
| T | getStrength () const noexcept |
| T | getRange () const noexcept |
| T | getWidth () const noexcept |
| T | getAttack () const noexcept |
| T | getRelease () const noexcept |
| Mode | getMode () const noexcept |
| Link | getLinkMode () const noexcept |
| T | getFoundationGuard () const noexcept |
| T | getLink () const noexcept |
| T | getSideWeight () const noexcept |
| bool | getRemovalListen () const noexcept |
| bool | getFocusListen () const noexcept |
| Quality | getQuality () const noexcept |
| bool | getQualityFollowsRender () const noexcept |
| Quality | getQualityInUse () const noexcept |
| T | getMix () const noexcept |
| T | getKnee () const noexcept |
| T | getPersistence () const noexcept |
| T | getQuietLevel () const noexcept |
| bool | getAuditoryWeighting () const noexcept |
| T | getWidthTaperCorner () const noexcept |
| T | getWidthTaperExponent () const noexcept |
| T | getRemovalBandLow () const noexcept |
| T | getRemovalBandHigh () const noexcept |
| Band | getSensitivityBand (int index) const noexcept |
| int | getLatency () const noexcept |
| T | getReduction (double hz) const noexcept |
| T | getDisplayReduction (int channel, int point) const noexcept |
| T | getDisplayExcess (int channel, int point) const noexcept |
| T | getPeakReduction () const noexcept |
| void | processBlock (AudioBufferView< T > buffer) noexcept |
| Processes the programme in place, detecting on itself. | |
| void | processBlock (AudioBufferView< T > buffer, AudioBufferView< T > key) noexcept |
| Processes the programme in place, detecting on a key (same length). | |
| std::vector< uint8_t > | getState () const |
| bool | setState (const uint8_t *data, size_t size) |
| Restores the settings. A blob of the first version (threshold and strength over the mean of the spectrum, where 3 dB and 0.7 were the defaults) is moved onto this one's scale. | |
Static Public Member Functions | |
| static double | getDisplayFrequency (int point) noexcept |
Static Public Attributes | |
| static constexpr int | kSensitivityBands = 6 |
| static constexpr int | kDisplayPoints = SpectralReadout<T>::kPoints |
| Points of the display curves, evenly in log frequency from 20 Hz to 20 kHz. | |
Dynamic suppression of resonances by a minimum-phase filter on a log-frequency grid.
| T | Sample type (float or double). |
Definition at line 97 of file ResonanceSuppressor.h.
| using dspark::ResonanceSuppressor< T >::Band = typename KeyEqualizer<T, 2>::Band |
Definition at line 104 of file ResonanceSuppressor.h.
|
strong |
| Enumerator | |
|---|---|
| PerBin | |
| MidSide | |
Definition at line 101 of file ResonanceSuppressor.h.
|
strong |
| Enumerator | |
|---|---|
| Smooth | |
| Deep | |
Definition at line 100 of file ResonanceSuppressor.h.
|
strong |
| Enumerator | |
|---|---|
| Realtime | |
| Offline | |
Definition at line 102 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 329 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 346 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 315 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 382 of file ResonanceSuppressor.h.
|
inlinestaticnoexcept |
Definition at line 366 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 375 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 337 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 333 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 343 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 353 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 334 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 332 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 342 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 331 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 384 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 344 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 338 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 339 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 341 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 345 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 327 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 355 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 330 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 350 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 349 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 336 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 351 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 324 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 335 of file ResonanceSuppressor.h.
|
inline |
Definition at line 398 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 326 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 325 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 328 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 347 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Definition at line 348 of file ResonanceSuppressor.h.
|
inline |
Allocates for a rate and a layout (an invalid spec is ignored).
Definition at line 107 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Processes the programme in place, detecting on itself.
Definition at line 389 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Processes the programme in place, detecting on a key (same length).
Definition at line 391 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Clears the analysis and the filter.
Definition at line 154 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Attack at 1 kHz, 0.5 to 500 ms (default 5; slower below, faster above, by the square root of the frequency).
Definition at line 185 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Weighs the amount by how well the ear hears each frequency (off by default): a third of the distance in dB from the threshold of hearing in quiet to its lowest point comes off the weight, so the same excess weighs at 150 Hz under half of what it does at 3 kHz.
Definition at line 258 of file ResonanceSuppressor.h.
|
inlinenoexcept |
The detail: how narrow what is found and cut is, from an octave to 1/24 of one (default 1/12). It moves while playing, at the same latency.
Definition at line 171 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Outputs the programme through the sensitivity curve.
Definition at line 216 of file ResonanceSuppressor.h.
|
inlinenoexcept |
How far what carries the programme from under it is spared, 0 to 1 (default 1): what is within 6 dB of the loudest with nothing within 20 dB underneath, like a sub bass, is then not taken under 70 Hz and by more as it rises, whole from 320 Hz. At 0 it is a resonance like any other, as deep in the low end as at the top. The same in both modes. Non-finite values are ignored.
Definition at line 206 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Soft knee at the threshold, 0 to 12 dB (0, the default, is the hard knee): the reduction grows smoothly on both sides of the threshold, so a resonance that hovers at it moves less from frame to frame.
Definition at line 230 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Per-point link, 0 (each channel its own) to 1 (one detector and filter), default 1.
Definition at line 210 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Stereo handling (PerBin by default).
Definition at line 208 of file ResonanceSuppressor.h.
|
inlinenoexcept |
How much of the filter is applied, 0 to 1 (default 1). The mix is taken inside the filter: its gain becomes 1 - mix + mix * gain before the minimum-phase filter is designed, so the part left alone and the part reduced never meet in two phases.
Definition at line 223 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Smooth (the default) works at the detail set and takes what stands over the loudest of its neighbours. Deep is more of both, detail and strength: it reads and cuts in half the detail (to 1/24 of an octave at the finest), takes both of two resonances closer than the detail and what stands over the mean of its peers, and takes up to half as deep again, setRange() included (under about 150 Hz no narrower, and as little as a fifth deeper).
Definition at line 197 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Tells the suppressor whether the host renders offline (read by the next prepare(); a plugin forwards its host's notice here before it prepares).
Definition at line 307 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Persistence, 0 to 500 ms (default 50; 0 counts at once): how long a resonance lasts before it counts, not at all until half of it has gone by and whole half of it later, however loud. A click, a consonant or the attack of a drum are over before they weigh.
Definition at line 238 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Realtime reads the long windows of the low end in turns, every two or four hops; Offline reads all of them every hop, for a render (applies at the next prepare(); the same latency).
Definition at line 294 of file ResonanceSuppressor.h.
|
inlinenoexcept |
With it on, a prepare() made while the host renders offline takes the Offline quality whatever setQuality() says (off by default): a bounce is made at the best quality with no setting to remember. The latency is the same in both.
Definition at line 301 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Level under which the suppressor lets go, -120 to 0 dBFS (off at -200, the default; anything under -190 turns it off). Each point is read as its amplitude plus this level, so what lies well over it is treated as before and what lies under it shows no resonance: quiet passages, tails and the noise of a room are left alone.
Definition at line 247 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Largest reduction, 0 to 48 dB (default 9; Mode::Deep reaches half as far again).
Definition at line 177 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Release at 1 kHz, 5 to 2000 ms (default 80).
Definition at line 187 of file ResonanceSuppressor.h.
|
inlinenoexcept |
The band setRemovalListen() plays, in hertz (0 and 0, the default, play all of it): what is taken out between the two frequencies alone, with a sixth of an octave of slope at each end. A listening aid like the listen itself: not part of the state. Non-finite values are ignored.
Definition at line 283 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Outputs what is taken out.
Definition at line 214 of file ResonanceSuppressor.h.
|
inlinenoexcept |
One band of the sensitivity curve (KeyEqualizer bands; the curve is a weight, its gain in dB / 12 + 1, clamped 0 to 2).
Definition at line 309 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Plays kernels of half their transform, tapered over their whole length (off by default; see DetailFilter::setShortKernel()): a cut rings for a shorter time after the event, at the same depth.
Definition at line 322 of file ResonanceSuppressor.h.
|
inlinenoexcept |
In MidSide, the side's reduction as a share of the mid's, 0 to 2 (default 1).
Definition at line 212 of file ResonanceSuppressor.h.
|
inline |
Restores the settings. A blob of the first version (threshold and strength over the mean of the spectrum, where 3 dB and 0.7 were the defaults) is moved onto this one's scale.
Definition at line 432 of file ResonanceSuppressor.h.
|
inlinenoexcept |
How much of what passes the threshold is taken out, 0 to 1 (default 1).
Definition at line 175 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Over the loudest of its neighbours by this much a peak is a resonance, 0 to 30 dB (default 5).
Definition at line 173 of file ResonanceSuppressor.h.
|
inlinenoexcept |
How far the neighbours a peak is compared with reach, in octaves beyond the detail, 0.05 to 4 (default 1/3). A side with no peak that near is read on to the next partial of a note.
Definition at line 183 of file ResonanceSuppressor.h.
|
inlinenoexcept |
Narrows setWidth() above a corner: it falls as (corner / frequency) to the exponent (0, the default, keeps it everywhere; 1 keeps it constant in hertz above the corner). Non-finite values are ignored.
| cornerHz | The corner, 200 Hz to 20 kHz. |
| exponent | 0 to 2. |
Definition at line 271 of file ResonanceSuppressor.h.
|
staticconstexpr |
Points of the display curves, evenly in log frequency from 20 Hz to 20 kHz.
Definition at line 364 of file ResonanceSuppressor.h.
|
staticconstexpr |
Definition at line 103 of file ResonanceSuppressor.h.