BASS.NET API for the Un4seen BASS Audio LibraryUtilsSampleDither Method BASS.NET API for the Un4seen BASS Audio Library
Applies a dither to a single sample value.

Namespace: Un4seen.Bass
Assembly: Bass.Net (in Bass.Net.dll) Version:

public static double SampleDither(
	double sample,
	double factor,
	double max


Type: SystemDouble
The sample data to add a dither to (e.g. an 8- or 16-bit sample value as a double value).
Type: SystemDouble
The bit depth factor for the dither (typically between 0.3 and 0.9).
Type: SystemDouble
The maximum sample data range (e.g. 256 for 8-bit samples or 32768 for 16-bit samples).

Return Value

Type: Double
The dithered sample value:

Dithering adds a low level white noise to the sample data before truncating for the purpose of minimizing quantization error.

Dithering here is implemented as a triangular probability density function (TPDF), actually a factor-bit triangular dither.

All parameters here are implemented as double values for maximum precision and performance. However, you might also pass 8-bit(byte) or 16-bit(short) values and then simply cast back the return value.

See Also