Read wav file in hexa

I want to read wav file in hexa, how i'm supposed to do that?
rawsignal=wavread('tes.wav','native');
above code returns me sample data in int16, can i convert it to hexa ? or even it's possible?

 Respuesta aceptada

per isakson
per isakson el 28 de Feb. de 2013

0 votos

Try something:
>> dec2hex(int8([126:127]),2)
ans =
7E
7F
and
>> dec2hex(int16([32765:32767]),4)
ans =
7FFD
7FFE
7FFF

8 comentarios

I Made
I Made el 28 de Feb. de 2013
Editada: I Made el 28 de Feb. de 2013
Yeah i read about it, but how about the minus integer like -114 for example ? from the documentation that function apply only on non minus integer. Do you know another function?
Walter Roberson
Walter Roberson el 28 de Feb. de 2013
dec2hex( typecast( rawsignal(:,1), 'uint16') )
per isakson
per isakson el 28 de Feb. de 2013
Editada: per isakson el 28 de Feb. de 2013
Signs
The hexadecimal system can express negative numbers the same way as in decimal: −2A to represent −4210 and so on.
Google: "negative hexadecimal number"
I Made
I Made el 28 de Feb. de 2013
Thanks Walter, but it's seems strange why after i change it to hexa the sample become more than before it was changed to hexa? it like :
rawsignal < 250608 x 2 double > -> < 1002432 x 4 char >, shouldn't it become more few after i change it to hexa?
Walter Roberson
Walter Roberson el 28 de Feb. de 2013
You said that the above code returned you rawsignal as int16, but now you are saying that rawsignal is double ??
I Made
I Made el 28 de Feb. de 2013
Editada: I Made el 28 de Feb. de 2013
Oh i'm really sorry i remove the 'native' code in
y=wavread('tes.wav','native');
My bad, sorry it's the same < 250608 x int16 > to < 250608 x 4char >
But it cannot display it, it's say : Cannot display summaries of variables with more than 524288 elements.
Walter Roberson
Walter Roberson el 28 de Feb. de 2013
I'm not sure what kind of summary you expect for characters anyhow?
The summary in the workspace browser is just a convenience and has no effect on the program.
I Made
I Made el 1 de Mzo. de 2013
Nothing important, i just wanna see it and solve the problem if anyhow i meet this kinda problem again. Anyway i've found how to do it, well we only need to write it down on excel. And very thank to both of you, you guys are great :D

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.

Preguntada:

el 28 de Feb. de 2013

Community Treasure Hunt

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

Start Hunting!

Translated by