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

Réponses (1)

Wayne King
Wayne King le 13 Sep 2012
Modifié(e) : Wayne King le 13 Sep 2012

0 votes

Have you tried using the 'native' option when you read the data.
[f,Fs] = wavread('wolf.wav','native');
class(f)

7 commentaires

Pat
Pat le 13 Sep 2012
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
Wayne King
Wayne King le 13 Sep 2012
Did you try using the 'native' option as I suggested? See my example.
Pat
Pat le 13 Sep 2012
Modifié(e) : Pat le 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
y0 = int16(f1 * 32768);
Pat
Pat le 14 Sep 2012
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
Walter Roberson
Walter Roberson le 14 Sep 2012
I am not familiar with the wavelet functions.
Pat
Pat le 15 Sep 2012
ok walter Thanks

Connectez-vous pour commenter.

Tags

Question posée :

Pat
le 13 Sep 2012

Community Treasure Hunt

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

Start Hunting!

Translated by