DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
dspark::OfflineSoftClipper< T > Class Template Referencefinal

OFFLINE ONLY: calibrates a soft curve to reduce the complete source peak. More...

#include <OfflineSoftClipper.h>

Inheritance diagram for dspark::OfflineSoftClipper< T >:
Collaboration diagram for dspark::OfflineSoftClipper< T >:

Additional Inherited Members

- Public Types inherited from dspark::detail::OfflineClipProcessor< T, true >
enum  Reason
 
using Curve = OfflineSoftClipCurve
 
using Options = std::conditional_t< Soft, OfflineSoftClipOptions, OfflineClipOptions >
 
- Public Member Functions inherited from dspark::detail::OfflineClipProcessor< T, true >
PlanResult makePlan (OfflineAudioSource< T > &source, const typename OfflineEnergyAnalyzer< T >::Analysis &analysis, const Options &options={}, const OfflineJobOptions &jobOptions={}) const
 Reuses complete-source energy analysis; no PCM or filtered audio is retained.
 
PlanResult analyze (OfflineAudioSource< T > &source, const Options &options={}, const OfflineJobOptions &job={}) const
 Analyzes the complete source and makes a reusable worker plan.
 
Result render (OfflineAudioSource< T > &source, const Plan &plan, OfflineAudioSink< T > &sink, const OfflineJobOptions &job={}) const
 Calibrates actual PCM, then verifies a provisional render before committing it.
 
Result run (const AudioBuffer< T, MaxChannels > &input, AudioBuffer< T, MaxChannels > &output, double sampleRate, const Options &options={}, const OfflineJobOptions &job={}) const
 Owning render; aliasing is safe and failure leaves output unchanged.
 
- Static Public Attributes inherited from dspark::detail::OfflineClipProcessor< T, true >
static constexpr double kTailTolerance
 Bound on the omitted exterior tail of the clipped signal: the accuracy the analysis padding is sized for. Float output uses 1e-9; the render then differs from a 1e-10 one by at most 3 ulp at -149 dB re peak, below the format's resolution, and runs 2.2x faster on 3 s of noise (Sine, 12 dB) and 1.4x on drums. Double output keeps 1e-10.
 

Detailed Description

template<FloatType T>
class dspark::OfflineSoftClipper< T >

OFFLINE ONLY: calibrates a soft curve to reduce the complete source peak.

Options::reductionDb is positive 0..12 dB; zero preserves exact PCM. Sine is the default curve; tanh and golden-ratio curves reuse Clipper's shared shapes. Options::oversamplingFactor is explicitly selectable (1/2/4/8/16, default 4). At factor 1 the clipping residual of a 32-sample windowed-sinc reconstruction is integrated over each sample interval and band-limited by a continuous kernel flat to 0.40 fs and below -65 dB from 0.47 fs on all of its images, so distortion folded across Nyquist is removed wherever it lands: a 10 kHz sine clipped by 6 dB at 48 kHz measures a -97 dB alias floor with the Sine curve and -99 dB with Tanh (both were -25 to -27 dB). The continuous-interval correction uses Core filters and convolution. Its internal delay is fully removed: the result has the source length and clock. Mono/stereo channels share one ceiling. Exclusions preserve exact samples with external 5 ms feathers. If these prevent the target, rendering fails without publishing output. No output gain trim or extra limiter is applied.

Threading: synchronous worker only. Sources stay immutable during every pass. Plans own their exclusions and fingerprint; const access is safe while alive and unmoved. This class has no audio-callback processing API.

Definition at line 35 of file OfflineSoftClipper.h.


The documentation for this class was generated from the following file: