From 547135779262cb7b4aadb4d42b7d4c9762547976 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Mon, 7 Nov 2022 20:07:24 +0200 Subject: [PATCH] Tools: Test: Audio: Replace the gaussian dither with triangular The gaussian (or other normal distribution shape) dither impacts too much 16 bit signals. The triangular probability density function (TDPF) is a sufficient compromise between added noise energy and de-correlation of PCM samples. This change improves for 48 kHz 16 bit audio measurement the THD+N from -62.6 dB to -73.6 dB. Signed-off-by: Seppo Ingalsuo --- tools/test/audio/test_utils/dither_and_quantize.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/test/audio/test_utils/dither_and_quantize.m b/tools/test/audio/test_utils/dither_and_quantize.m index 56a2a58b7..83d3a7a21 100644 --- a/tools/test/audio/test_utils/dither_and_quantize.m +++ b/tools/test/audio/test_utils/dither_and_quantize.m @@ -51,8 +51,7 @@ sx = size(x); nx = sx(1); nch = sx(2); -xq = int32(floor( scale*x + randn(nx,nch) - randn(nx,nch) -0.5)); % TPDF dither -%xq = int32(round( scale*x )); % Omit dither +xq = int32(round(scale * x + rand(nx,nch) + rand(nx, nch) - 1)); % TPDF dither idx = find(xq > smax); xq(idx) = smax; idx = find(xq < smin);