Encoding the signal with 16 bits

I have a sound wave
I have a code
[f,Fs] = wavread('wolf.wav');
sound(f, Fs);
please tell how to encode the soundwave by 16 bits

Answers (1)

Wayne King
Wayne King on 13 Sep 2012
Edited: Wayne King on 13 Sep 2012
Have you tried using the 'native' option when you read the data.
[f,Fs] = wavread('wolf.wav','native');
class(f)

7 Comments

Thanks Wayne i Tried
[y, fs, nbits]=wavread('wolf.wav');
y0=y*(2^nbits/2)+(2^nbits/2);
but i get class as double ,can u tell where i made mistake plz
Did you try using the 'native' option as I suggested? See my example.
Pat
Pat on 13 Sep 2012
Edited: Pat on 13 Sep 2012
As per your code the class is int16
[f,Fs] = wavread('wolf.wav','native');
class(f)
i tried by
[f1,Fs1] = wavread('wolf.wav');
y0=f1*32768 ,i get the same values
the minimum and maximum values are same for y0 and f
but the class is different ,i get class as double
i tried this code because i need for 14bit also ,
please help
Thanks walter,for decomposing a soundwave wave by dwt haar wavelet i tried
[c,l] = wavedec(f,1,'Haar');f is my sound signal,is it correct
I am not familiar with the wavelet functions.
ok walter Thanks

Sign in to comment.

Tags

Asked:

Pat
on 13 Sep 2012

Community Treasure Hunt

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

Start Hunting!