34template <
typename SampleType =
double>
53template <
typename SampleType =
float>
57 sample_rate_ = sr > 0.0 ? sr : sample_rate_;
75 const auto pair = hilbert_.process(
static_cast<double>(input));
78 phase_ -= std::floor(phase_);
80 const double angle = 2.0 * 3.14159265358979323846 * phase_;
81 return static_cast<SampleType
>(pair.in_phase * std::cos(angle) -
82 pair.quadrature * std::sin(angle));
86 void update() { increment_ = shift_hz_ / sample_rate_; }
89 double sample_rate_ = 44100.0;
90 double shift_hz_ = 0.0;
91 double increment_ = 0.0;
Shifts every frequency in a signal by the same number of Hz.
Definition frequency_shifter.hpp:54
SampleType process(SampleType input)
Definition frequency_shifter.hpp:74
void set_sample_rate(double sr)
Definition frequency_shifter.hpp:56
double shift_hz() const
Definition frequency_shifter.hpp:67
void reset()
Definition frequency_shifter.hpp:69
void set_shift_hz(double hz)
Amount to add to every frequency, in Hz. Negative shifts downward.
Definition frequency_shifter.hpp:62
A pair of allpass cascades whose outputs stand a quarter cycle apart across nearly the whole band — t...
Definition frequency_shifter_ssb.hpp:210
The single-sideband (Bode/Moog) frequency shifter: a Hilbert phase-difference network,...
Definition additive_bank.hpp:218
HilbertPairT< double > HilbertPair
Definition frequency_shifter.hpp:95
FrequencyShifterT< float > FrequencyShifter
Definition frequency_shifter.hpp:96
FrequencyShifterT< double > FrequencyShifter64
Definition frequency_shifter.hpp:97
HilbertQuadratureNetworkT< SampleType > HilbertPairT
A pair of allpass chains whose outputs stand a quarter cycle apart across the audio band — the analyt...
Definition frequency_shifter.hpp:35