The three lo-fi stages in the order the hardware they model applies them: quantise the word, hold it at a lower clock, then push it through an output stage that cannot represent the smallest codes. More...
#include <lofi_chain.hpp>
Public Member Functions | |
| void | set_sample_rate (double sr) |
| void | set_bits (double bits) |
| Word length in bits. 24 or above bypasses the quantiser. | |
| void | set_dither_mode (DitherMode mode) |
| Quantizer dither is opt-in so existing chains remain bit-exact. | |
| void | set_noise_shaping (NoiseShapingOrder order) |
| Error feedback is opt-in and may be used with or without dither. | |
| void | set_hold_rate_hz (double hz) |
| Hold clock in Hz. | |
| void | set_jitter (double amount) |
| void | set_smoothing (double amount) |
| void | set_dead_zone (double amount) |
| Fraction of full scale the output stage cannot represent, 0 to 0.9. | |
| void | set_seed (std::uint32_t seed) |
| void | sync_configuration_from (const LofiChainT &other) |
| Mirror parameter configuration while preserving this chain's independent reducer/filter state. | |
| void | reset () |
| bool | has_tail () const noexcept |
| SampleType | process (SampleType input) |
| void | process (SampleType *buffer, int num_samples) |
The three lo-fi stages in the order the hardware they model applies them: quantise the word, hold it at a lower clock, then push it through an output stage that cannot represent the smallest codes.
Keeping them in one class rather than three loose calls is what makes the order a property of the code instead of a convention each caller has to remember. Any stage left at its default is a pass-through, so a voice can use one of the three without paying for the others.
This chain distorts, so it generates harmonics above the input's bandwidth and will alias if run at the host rate. Callers that care run it inside an oversampled section (pulp::signal::Oversampling); callers modelling a device that itself aliased run it at the host rate deliberately.
RT contract: every member allocates nothing and takes no locks.
|
inlinenoexcept |
|
inline |
|
inline |
|
inline |
|
inline |
Word length in bits. 24 or above bypasses the quantiser.
|
inline |
Fraction of full scale the output stage cannot represent, 0 to 0.9.
|
inline |
Quantizer dither is opt-in so existing chains remain bit-exact.
|
inline |
Hold clock in Hz.
At or above the sample rate the reducer is transparent.
|
inline |
|
inline |
Error feedback is opt-in and may be used with or without dither.
|
inline |
|
inline |
|
inline |
|
inline |
Mirror parameter configuration while preserving this chain's independent reducer/filter state.