MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ sinc_bandpass()

MAYAFLUX_API std::vector< double > MayaFlux::Kinesis::Discrete::sinc_bandpass ( double  low_hz,
double  high_hz,
double  sample_rate,
size_t  taps 
)

Windowed-sinc bandpass FIR coefficients.

Difference of two lowpass kernels. Requires low_hz < high_hz; the arguments are swapped internally if supplied in the other order.

Parameters
low_hzLower cutoff in Hz
high_hzUpper cutoff in Hz
sample_rateSampling rate in Hz
tapsKernel length, forced odd
Returns
Coefficient vector of length taps or taps + 1

Definition at line 306 of file Coefficients.cpp.

307{
308 double lo = low_hz;
309 double hi = high_hz;
310 if (lo > hi)
311 std::swap(lo, hi);
312
313 const size_t n = force_odd(taps);
314 std::vector<double> upper = lowpass_kernel(hi, sample_rate, n);
315 const std::vector<double> lower = lowpass_kernel(lo, sample_rate, n);
316
317 for (size_t i = 0; i < n; ++i)
318 upper[i] -= lower[i];
319
320 return upper;
321}