|
Gin
|
Dither and noise shaping for bit depth reduction. More...
#include <gin_dither.h>
Public Types | |
| enum | NoiseType { none = 0 , rectangular , triangular , gaussian } |
| Probability distribution of the dither noise. More... | |
| enum | Shaping { flat = 0 , highpass } |
| Spectrum of the dither noise itself. More... | |
Public Member Functions | |
| Dither ()=default | |
| ~Dither ()=default | |
| void | setBitDepth (int bits) |
| Target bit depth. | |
| void | setNoiseType (NoiseType t) |
| void | setShaping (Shaping s) |
| void | setAmount (float lsbs) |
| Dither depth in LSBs. | |
| void | setNoiseShaping (float ns) |
| Error feedback noise shaping, 0 to 1. | |
| void | reset () |
| void | process (juce::AudioSampleBuffer &buffer) |
Dither and noise shaping for bit depth reduction.
Truncating to a lower bit depth correlates the error with the signal, which is what makes quiet fades sound grainy and reverb tails turn to gravel rather than simply getting quieter. Adding a small amount of noise before quantising decorrelates it: the error becomes hiss, which is far less objectionable than distortion that tracks the music.
Noise shaping goes further and feeds the quantisation error back through a second order filter, pushing the noise out of the midrange where the ear is most sensitive.
Key Features:
Usage:
Note: TPDF (triangular) at 2 LSB is the standard, safe default - it fully decorrelates the error at the cost of a little more noise than RPDF.
Probability distribution of the dither noise.
| Enumerator | |
|---|---|
| none | |
| rectangular | |
| triangular | |
| gaussian | |
|
default |
|
default |
| void Dither::reset | ( | ) |