template<typename SampleType = float>
class pulp::signal::FrequencyShifterT< SampleType >
Shifts every frequency in a signal by the same number of Hz.
This is not a pitch shift and the difference is the entire point. A pitch shift multiplies every partial by a ratio, so a harmonic series stays harmonic and the sound keeps its identity at a new pitch. A frequency shift adds a constant, so a series at 100, 200, 300 Hz becomes 130, 230, 330 Hz — no longer integer multiples of anything. The result has no fundamental and no pitch, which is exactly what is wanted when a bank of resonators is ringing on a chord and the chord is the problem: a shift of a few tens of hertz turns tuned metal into a cymbal.
Implemented by single-sideband modulation: split the input into a quadrature pair, modulate each by a sine and cosine at the shift frequency, and subtract. Adding instead of subtracting selects the other sideband, which is why the shift can go down as well as up — here that is reached by the sign of set_shift_hz, which runs the carrier's phase accumulator backwards.