Skip to main content

heterodyne

Function heterodyne 

Source
pub fn heterodyne(
    samples: &[f64],
    rate: SampleRate,
    params: HeterodyneParams,
) -> Result<Baseband, FilterError>
Expand description

Moves the band around centre to baseband, so a tone at f_c + d comes out at d.

It multiplies the signal by 2 exp(-j 2 pi f_c t), low-passes the product with a fourth-order Butterworth at cutoff, and keeps every decimation-th sample. A partial A cos(2 pi f t + phi) comes out as A exp(j (2 pi (f - f_c) t + phi)), so the envelope reads A. The first samples carry the filter’s start-up transient.

§Errors

Returns a FilterError when the cutoff is zero or not below the Nyquist frequency.