Dithering audio before quantization

4 views (last 30 days)
walzer91
walzer91 on 6 Dec 2013
Hi everyone, my name's Walter and I'm Italian (sorry for my terrible English). I'm trying to solve an exercise my teacher gave me, but I found some problems. I have to write a matlab script that implements the audio dithering. The script receives as input a wav audio file (coded at 44.1kHz and 16 bit) and it has to be compressed at 2-3 bit! I have to show the difference between using a normal quantization and a quantization after dithering. I think I succeed in doing an easy version of quantization, but I have no idea how to apply the dithering. I made an easy version of quantization... can someone help me? I paste the code i wrote
function [fileQU,error]=quantizzazione(file,n_bit)
% Quantization function of a stereo file wav
% Normalization of the two tracks
fileQL = file(:,1)/max(abs(file(:,1)));
fileQR = file(:,2)/max(abs(file(:,2)));
% Quantization by rounding
fileQU(:,1)=round(fileQL*2^(n_bit-1))/(2^(n_bit-1));
fileQU(:,2)=round(fileQR*2^(n_bit-1))/(2^(n_bit-1));
error = file - fileQU;
end

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!