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

Streaming GCC-PHAT delay estimator with sub-sample refinement. More...

#include <DelayEstimator.h>

Classes

struct  Result
 What estimate() returns. More...
 

Public Member Functions

void prepare (double sampleRate, int maxDelaySamples)
 Allocates for a search range.
 
void reset () noexcept
 Forgets everything pushed.
 
void push (AudioBufferView< const T > reference, AudioBufferView< const T > delivery) noexcept
 Feeds the next stretch of both signals (same length; channels averaged). Allocation free.
 
Result estimate () noexcept
 The delay over everything pushed so far. Allocation free.
 
int getFrameSize () const noexcept
 Frame length in samples (the analysis resolution in time).
 

Static Public Member Functions

static Result estimate (AudioBufferView< const T > reference, AudioBufferView< const T > delivery, double sampleRate, int maxDelaySamples)
 Whole-signal convenience: one estimate over two buffers. Allocates.
 

Detailed Description

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

Streaming GCC-PHAT delay estimator with sub-sample refinement.

est.prepare(48000.0, 48000); // search +-1 s
for (each block) est.push(referenceBlock, deliveryBlock);
const auto r = est.estimate();
if (r.valid && r.confidence > 0.5) align(delivery, r.delaySamples);
Streaming GCC-PHAT delay estimator with sub-sample refinement.
Result estimate() noexcept
The delay over everything pushed so far. Allocation free.
void prepare(double sampleRate, int maxDelaySamples)
Allocates for a search range.
void push(AudioBufferView< const T > reference, AudioBufferView< const T > delivery) noexcept
Feeds the next stretch of both signals (same length; channels averaged). Allocation free.
Template Parameters
TSample type (float or double).

Definition at line 93 of file DelayEstimator.h.

Member Function Documentation

◆ estimate() [1/2]

template<FloatType T>
Result dspark::DelayEstimator< T >::estimate ( )
inlinenoexcept

The delay over everything pushed so far. Allocation free.

Definition at line 178 of file DelayEstimator.h.

◆ estimate() [2/2]

template<FloatType T>
static Result dspark::DelayEstimator< T >::estimate ( AudioBufferView< const T >  reference,
AudioBufferView< const T >  delivery,
double  sampleRate,
int  maxDelaySamples 
)
inlinestatic

Whole-signal convenience: one estimate over two buffers. Allocates.

Definition at line 232 of file DelayEstimator.h.

◆ getFrameSize()

template<FloatType T>
int dspark::DelayEstimator< T >::getFrameSize ( ) const
inlinenoexcept

Frame length in samples (the analysis resolution in time).

Definition at line 229 of file DelayEstimator.h.

◆ prepare()

template<FloatType T>
void dspark::DelayEstimator< T >::prepare ( double  sampleRate,
int  maxDelaySamples 
)
inline

Allocates for a search range.

Parameters
sampleRateSample rate of both signals.
maxDelaySamplesLargest delay searched, either way (>= 1). The frame is the power of two at least eight times this (and at least 4096), and so is the memory.

Definition at line 113 of file DelayEstimator.h.

◆ push()

template<FloatType T>
void dspark::DelayEstimator< T >::push ( AudioBufferView< const T >  reference,
AudioBufferView< const T >  delivery 
)
inlinenoexcept

Feeds the next stretch of both signals (same length; channels averaged). Allocation free.

Definition at line 154 of file DelayEstimator.h.

◆ reset()

template<FloatType T>
void dspark::DelayEstimator< T >::reset ( )
inlinenoexcept

Forgets everything pushed.

Definition at line 139 of file DelayEstimator.h.


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