Module symphonia_core::conv::dither
source · Expand description
The dither
module provides methods to apply a dither to a sample.
Dithering is the process of adding noise to the least significant digits of a sample before down-converting (quantizing) it to a smaller sample type. The purpose of dithering is to decorrelate the quantization error of the down-conversion from the source signal.
Dithering is only applied on lossy conversions. Therefore the dither
module will only
apply a dither to the following down-conversions:
- {
i32
,u32
} to {i24
,u24
,i16
,u16
,i8
,u8
} - {
i24
,u24
} to {i16
,u16
,i8
,u8
} - {
i16
,u16
} to {i8
,u8
}
Multiple dithering algorithms are provided, each drawing noise from a different probability distribution. In addition to different distributions, a dithering algorithm may also shape the noise such that the bulk of the noise is placed in an inaudible frequency range.
Structs§
- The
Identity
dithering algorithm performs no dithering and returns the original sample. RandomNoise
represents a sample of noise of a specified length in bits.Rectangular
implements a dither using uniformly distributed (white) noise without shaping.Triangular
implements a dither using a triangular distribution of noise without shaping.
Enums§
- Enumeration of dither algorithms.
Traits§
AddNoise
is a trait for converting random noise into aSample
.Dither
is a trait for implementing dithering algorithms.MaybeDither
conditionally applies a dither to a sample depending on the source and destination sample types.