but i notice that the size of the data file after and before the wdencmp is the same,
What you are writing to the file is the reconstructed signal, not the wavelet coefficients. The size of the reconstructed signal is the same as the size of the input.
You are expecting that the output file will be smaller than the original file. That implies one of two possibilities:
- Perhaps you are getting confused about what is being written to the file, and are thinking that just the compressed coefficients are being written to the file; Or
- Perhaps you expecting that audiowrite() does compression on the signal it is asked to write, and you are expecting that the reconstructed signal will happen to be more compressible under whatever compression algorithm that audiowrite() might potentially be using.
But is audiowrite() compressing when you write with those parametes?
testsignal0 = zeros(N, 1);
testsignal1 = linspace(-1, 1, N) .';
testsignal2 = rand(N, 1);
audiowrite('testsignal0.wav', testsignal0, Fs);
audiowrite('testsignal1.wav', testsignal1, Fs);
audiowrite('testsignal2.wav', testsignal2, Fs);
You can see that the files are all exactly the same size -- 2 bytes per sample (per channel) plus a 44 byte header.
So... any difference you are seeing in the size of the files is due to one of two possibilities:
- the original .wav file might have been written with a different audio encoder; Or
- the original .wav file had additional headers (such as copyright information or song name) that is not being written out when you audiowrite()