|
A Hopf, Skip and a Jump
|
Shift a signal by a given frequency. More...
#include <frequencyshifter.h>
Public Types | |
| enum | HilbertMode { fir, fft } |
Public Member Functions | |
| FrequencyShifter (const inputSample_t *inputSignal, const std::size_t inputSignalSize, const double sr, HilbertMode mode=HilbertMode::fir) | |
| Construct a FrequencyShifter, which uses either an FIR or FFT. More... | |
| void | shift (const parameter_t fShift, inputSample_t *shiftedSignal, const std::size_t shiftedSignalSize) |
| Shift the input signal by the stated amount and fill shiftedSignal. More... | |
Protected Attributes | |
| const inputSample_t * | inputSignal |
| input signal | |
| const std::size_t | inputSignalSize |
| input signal size | |
| std::complex< inputSample_t > * | analyticSignal |
| Complex array to store results of Hilbert transform. | |
| const parameter_t | sr |
| Sample rate. | |
Shift a signal by a given frequency.
Use SSB modulation, implemeted via the Hilbert transform (which is itself implemented with FFTs from the FFTW library).
Definition at line 12 of file frequencyshifter.h.
| Enumerator | |
|---|---|
| fir | FIR. |
| fft | FFT. |
Definition at line 15 of file frequencyshifter.h.
| FrequencyShifter::FrequencyShifter | ( | const inputSample_t * | inputSignal, |
| const std::size_t | inputSignalSize, | ||
| const double | sr, | ||
| HilbertMode | mode = HilbertMode::fir |
||
| ) |
Construct a FrequencyShifter, which uses either an FIR or FFT.
We rely on the float version (low precision) of FFTW3 for all the transforms, and assume inputSample_t to be float. Make the code work for inputSample_t double or long double (e.g. using templates) is not currently supported. Additionally the double-precision version of the FFTW3 library would have to be linked.
| inputSignal | The signal to be shifted |
| inputSignalSize | Length of the signal |
| sr | Sample rate of the audio |
| mode | FrequencyShifter.fir or FrequencyShifter.fft |
| void FrequencyShifter::shift | ( | const parameter_t | fShift, |
| inputSample_t * | shiftedSignal, | ||
| const std::size_t | shiftedSignalSize | ||
| ) |
Shift the input signal by the stated amount and fill shiftedSignal.
| fShift | Frequency by which to shift the signal (Hz) |
| shiftedSignal | Output buffer |
| shiftedSignalSize | Length of the output buffer |
1.8.13