% quantization_demo.m % Demo of uniform quantization of speech. % Load speech signal % Choose number of bits R to set L = 2^R quantization levels R = 7; L = 2^R; s = auread('qorig.au'); % Normalize amplitudes to range [+0.5, -0.5] s = s/max(s)*0.5; % Perform the quantization sq = round(s*L)/L; % Play the original sound(s) % Play the quantized version sound(sq) fprintf('Quantized with R = %d bits = %d levels\n', R, L); fprintf('Signal-to-quantization-noise ratio = %f dB\n', 1.8 + 6*R);