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

High-quality sample rate converter for audio signals. More...

#include "AudioBuffer.h"
#include "AudioSpec.h"
#include "SimdOps.h"
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstddef>
#include <limits>
#include <numbers>
#include <vector>
Include dependency graph for Resampler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  dspark::Resampler< T >
 Windowed-sinc sample rate converter optimized for real-time DSP. More...
 

Namespaces

namespace  dspark
 Main namespace for the DSPark framework.
 

Detailed Description

High-quality sample rate converter for audio signals.

Converts audio between different sample rates (e.g., 44100 <-> 48000 <-> 96000 Hz) with configurable quality. Uses polyphase windowed-sinc interpolation (Kaiser window, 256 tabulated phases + linear phase interpolation, SIMD dot-product kernels) – the method used in professional DAWs and mastering tools.

Two modes:

  • Offline (batch): process() converts an entire buffer at once and is time-aligned (zero latency – the symmetric kernel reads future samples). Best for file processing.
  • Streaming: processBlock() converts chunks incrementally and is causal: the output is delayed by getLatency() samples. Best for real-time applications where audio arrives in blocks.

Threading: prepare() allocates and must run on a setup thread. After prepare(), processBlock() and reset() are allocation-free and belong to the single stream owner; there are no cross-thread parameter setters.

Dependencies: AudioBuffer.h, AudioSpec.h, SimdOps.h.

Definition in file Resampler.h.