Archived from groups: rec.audio.tech,comp.dsp (
More info?)
jim <"N0sp"@m.sjedging@mwt.net> writes:
> [...]
> Why would the scale of the sine wave make any difference or maybe I
> misunderstand what you're saying.
Simple - signal-to-noise ratio. The higher the sine wave (up to
FS clipping) the higher the signal power and the better the SNR.
If you use dither, I would think, even with only 1 bit, you could
hear a sine wave at lower levels than FS, but FS would almost
definitely be audible.
Wait - I'll try it...
Yep, you can hear a FS sine wave just fine - boomin'! A Chopin
piano piece came through lovely too, just with a bunch of noise.
Here are the Matlab scripts in case you want to try this at home:
% Modify as required
[chopin,Fs,N] = wavread('~/wav/chopin');
wavwrite(quantize(chopin,1,1),Fs, N, 'chopinq');
quantize.m
----------
function y = quantize(x,N,ditherBool)
%function y = quantize(x,N,dBool)
% FUNCTION: N-bit Dithered Quantizer
% AUTHOR: Randy Yates
% DATE: 05-21-2004
% PARAMETERS:
% x = real input vector to be quantized, in the range -1 to +1.
% N = number of bits
% ditherBool
% 0 = do NOT dither
% 1 = add TPDF dither of appropriate amplitude to x before quantizing
% DESCRIPTION:
% This function takes the input x and quantizes it N bits.
% Both the input and output will be in the range -1 to +1.
% generate dither
d = ditherBool*(rand(size(x)) + rand(size(x)) - 1);
x1 = x*2^(N-1) + 2^(N-1) - 1/2;
x2 = clip(x1+d,-0.5+20*eps,2^N - 1 - 20*eps);
x2 = round(x2);
x3 = x2* (2/(2^N - 1)) - 1;
y = x3;
clip.m
------
function y = clip(x, Mmin, Mmax)
%function y = clip(x, min, max)
% FUNCTION: clip
% AUTHOR: Randy Yates
% DATE: 05-21-2004
% PARAMETERS:
% x = real input vector to be clipped
% Mmin = lower clip level
% Mmax = upper clip level
% DESCRIPTION:
% The input will be clipped so that Mmin <= y <= Mmax
y = min(x,Mmax);
y = max(y,Mmin);
--
Randy Yates
Sony Ericsson Mobile Communications
Research Triangle Park, NC, USA
randy.yates@sonyericsson.com, 919-472-1124