Sample rate conversions

The most straightforward way to change the sampling rate of a signal of finite length is to use the resample() function (defined in lien non trouvé : [dsp_8hpp_source]dsp/dsp.hpp).

The functions described below enable on the contrary to process streaming signals, using filter structures with context.

The most general resampling filter (arbitrary resampling ratio) can be instanciated with the function filter_resample(). The other filters are more specific (integer or rational resampmling rate).

// Divide the sampling frequency by 100
let f = filter_resample(0.01);
let y = f->step(x);


Sub-groups

Interpolators
Several classical interpolation structures (linear, polynomial, sinc, etc.)

Enumerations

InterpOption : LINEAR | CSPLINE;

Interpolation type for a randomly sampled signal.

Functions

sptr<FilterGen<T>> filter_fir_decim(const Vector<Tc> &h, unsigned int R)
FIR filtering with post-decimation (compute only one output sample every \(R\) input ones).

sptr<FilterGen<T>> filter_fir_half_band(const Vector<Tc> &c)
To be documented : FIR filter optimized for half-band filtering.

sptr<FilterGen<T>> filter_fir_ups(const Vector<Tc> &h, unsigned int R)
FIR filtering with interpolation (polyphase implementation)

float filter_fir_ups_delay(int nc, int R)
Computes the delay of a FIR upsampling filter.

sptr<FilterGen<T>> filter_resample(float ratio)
Rythm adapter, with arbitrary ratio.

sptr<FilterGen<T>> filter_itrp(float ratio, sptr<Interpolator<T>> itrp=itrp_cspline<T>())
Arbitrary rate interpolator.

Vector<T> interp(const Vecf &x, const Vector<T> &y, const Vecf &x2, InterpOption mode=LINEAR)
Interpolation of a randomly sampled signal.