DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
Loading...
Searching...
No Matches
Saturation.h File Reference

Professional multi-algorithm saturation processor with analog simulation. More...

#include "../Core/AudioBuffer.h"
#include "../Core/AudioSpec.h"
#include "../Core/Biquad.h"
#include "../Core/DryWetMixer.h"
#include "../Core/DspMath.h"
#include "../Core/Oversampling.h"
#include "../Core/Smoothers.h"
#include "../Core/AnalogRandom.h"
#include "../Core/SpscQueue.h"
#include "../Core/SpinLock.h"
#include "../Core/StateBlob.h"
#include "DCBlocker.h"
#include "MidSide.h"
#include <algorithm>
#include <array>
#include <atomic>
#include <cmath>
#include <cstdint>
#include <cstring>
#include <limits>
#include <memory>
#include <type_traits>
#include <vector>
Include dependency graph for Saturation.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  dspark::detail::SaturationAlgorithm< T >
 
class  dspark::detail::TanhAlgorithm< T >
 
class  dspark::detail::TubeAlgorithm< T >
 
class  dspark::detail::HardClipAlgorithm< T >
 
class  dspark::detail::ExciterAlgorithm< T >
 
class  dspark::detail::WavefolderAlgorithm< T >
 
class  dspark::detail::BitcrusherAlgorithm< T >
 
class  dspark::detail::TapeAlgorithm< T >
 
class  dspark::detail::TransformerAlgorithm< T >
 
class  dspark::detail::DownsampleAlgorithm< T >
 
class  dspark::detail::MultiStageAlgorithm< T >
 
class  dspark::Saturation< SampleType >
 Professional multi-algorithm saturation processor with analog simulation. More...
 
struct  dspark::Saturation< SampleType >::Params
 

Namespaces

namespace  dspark
 Main namespace for the DSPark framework.
 
namespace  dspark::detail
 

Functions

template<typename T >
dspark::detail::logCosh (T x) noexcept
 

Detailed Description

Professional multi-algorithm saturation processor with analog simulation.

This class provides a high-quality saturation pipeline featuring 10 distinct algorithms ranging from soft clipping to complex magnetic tape and transformer modeling. Latency is zero at 1x oversampling; with oversampling enabled it equals the oversampler group delay (see getLatency()).

Architecture & Performance:

  • Real-Time Safe: no memory allocations or blocking calls in the process path (parameter recovery uses a bounded try-lock, never a wait).
  • No virtual dispatch in the per-sample hot path: the algorithm is resolved statically once per block.
  • Lock-free parameters: changes travel as complete snapshots through a single-producer/single-consumer queue.
  • Per-channel state is bounded to 16 channels; channels beyond the prepared spec (or beyond 16) bypass the saturation stage.

Dependencies: Core/AudioBuffer.h, Core/AudioSpec.h, Core/Biquad.h, Core/DryWetMixer.h, Core/DspMath.h, Core/Oversampling.h, Core/Smoothers.h, Core/AnalogRandom.h, Core/SpscQueue.h, Core/SpinLock.h, Core/StateBlob.h, Effects/DCBlocker.h, Effects/MidSide.h.

Threading: prepare(), setOversampling() and setState() belong to the setup thread; process() and reset() to the audio thread; the remaining setters and getters may be called from any thread (snapshot queue / relaxed atomics).

Template Parameters
SampleTypeThe floating-point precision to use (must be float or double).

Definition in file Saturation.h.