resample_freq
DFT based zero-phase resampling.
Namespace: dsp::fourier
Prototype
Vector<T> resample_freq(const Vector<T> &x, float ratio)
Parameters
x | Input vector. |
ratio | Desired ratio between output and input sample rates. (a ratio greater than 1 can be used for interpolation, and a ratio less than 1 for a decimation). |
Description
This function will resample a signal, without introducing any delay, by working in the frequency domain.
- Warning
- Note that, because of some assumptions implicit with the DFT, some artefacts may be created at the signal borders. To mitigate this phenomena, one can pre-apply a window, or insert zeroes before and after the actual samples, but these are not perfect solutions.
Example showing the spurius artefacts
soit x = linspace(0, 1 - 1.0/10, 10),
// Interpolation d'un facteur 10
// (10 fois plus d'échantillons en sortie)
y = rééchan_freq(x, 10);
Figure f;
soit t = x,
t2 = linspace(0, 1 - 1.0/100, y.rows());
f.plot(t, x, "b-o" , "x" );
f.plot(t2, y, "g-" , "y" );