|
| Oversampling (size_t numChannels, size_t factor, FilterType type, bool isMaxQuality=true) |
| Constructor of the oversampling class. More...
|
|
| Oversampling (size_t numChannels=1) |
| Default constructor of the oversampling class, which can be used to create an empty object and then add the appropriate stages. More...
|
|
| ~Oversampling () |
| Destructor. More...
|
|
SampleType | getLatencyInSamples () noexcept |
| Returns the latency in samples of the whole processing. More...
|
|
size_t | getOversamplingFactor () noexcept |
| Returns the current oversampling factor. More...
|
|
void | initProcessing (size_t maximumNumberOfSamplesBeforeOversampling) |
| Must be called before any processing, to set the buffer sizes of the internal buffers of the oversampling processing. More...
|
|
void | reset () noexcept |
| Resets the processing pipeline, ready to oversample a new stream of data. More...
|
|
dsp::AudioBlock< SampleType > | processSamplesUp (const dsp::AudioBlock< SampleType > &inputBlock) noexcept |
| Must be called to perform the upsampling, prior to any oversampled processing. More...
|
|
void | processSamplesDown (dsp::AudioBlock< SampleType > &outputBlock) noexcept |
| Must be called to perform the downsampling, after the upsampling and the non-linear processing. More...
|
|
void | addOversamplingStage (FilterType, float normalizedTransitionWidthUp, float stopbandAttenuationdBUp, float normalizedTransitionWidthDown, float stopbandAttenuationdBDown) |
|
void | addDummyOversamplingStage () |
|
void | clearOversamplingStages () |
|
template<typename SampleType>
class dsp::Oversampling< SampleType >
A processing class performing multi-channel oversampling.
It can be configured to do 2 times, 4 times, 8 times or 16 times oversampling using a multi-stage approach, either polyphase allpass IIR filters or FIR filters for the filtering, and reports successfully the latency added by the filter stages.
The principle of oversampling is to increase the sample rate of a given non-linear process, to prevent it from creating aliasing. Oversampling works by upsampling N times the input signal, processing the upsampling signal with the increased internal sample rate, and downsample the result to get back the original processing sample rate.
Choose between FIR or IIR filtering depending on your needs in term of latency and phase distortion. With FIR filters, the phase is linear but the latency is maximum. With IIR filtering, the phase is compromised around the Nyquist frequency but the latency is minimum.
- See also
- FilterDesign.
template<typename SampleType >
Returns the latency in samples of the whole processing.
Use this information in your main processor to compensate the additional latency involved with the oversampling, for example with a dry / wet functionality, and to report the latency to the DAW.
Note: The latency might not be integer, so you might need to round its value or to compensate it properly in your processing code.