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:
- Rectangular, triangular and near-gaussian noise
- Optional highpass shaped noise
- Second order error feedback noise shaping
- Any bit depth
Usage:
void process(juce::AudioSampleBuffer &buffer)
Definition gin_dither.h:113
@ triangular
Definition gin_dither.h:74
void setNoiseType(NoiseType t)
Definition gin_dither.h:98
void setBitDepth(int bits)
Target bit depth.
Definition gin_dither.h:92
void setNoiseShaping(float ns)
Error feedback noise shaping, 0 to 1.
Definition gin_dither.h:105
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.
- See also
- BitCrusher