+ Post New Thread
Results 1 to 6 of 6

24th April 2010, 00:37 #1
 Join Date
 Apr 2010
 Location
 egypt
 Posts
 4
 Helped
 2 / 2
 Points
 501
 Level
 4
matlab convertion from .wav to binary
hi all,
I want to convert an audio or a wav file into binary form like y=[100110111].. i found the fun wavread but it give me result from 1 to 1 and not a a form of vector... so can any one help me how to convert the wave file to the binary
thank u

Advertisement

24th April 2010, 05:02 #2
 Join Date
 Oct 2008
 Location
 Sindh, Pakistan
 Posts
 895
 Helped
 181 / 181
 Points
 9,408
 Level
 23
matlab convertion from .wav to binary
you need an adc and codec function after wavread.
1 members found this post helpful.

Advertisement

24th April 2010, 15:20 #3
 Join Date
 Apr 2010
 Location
 egypt
 Posts
 4
 Helped
 2 / 2
 Points
 501
 Level
 4
Re: matlab convertion from .wav to binary
ok ..any suggestion about the function using in matlab for adc & codec.....Thx for ur help
1 members found this post helpful.

Advertisement

25th April 2010, 09:58 #4
 Join Date
 Apr 2002
 Posts
 149
 Helped
 36 / 36
 Points
 3,506
 Level
 13
Re: matlab convertion from .wav to binary
Hello kimo77
I don't know the function wavread but from what you wrote ("... result from 1 to 1 ") I suppose that it returns the numeric values of the audio samples encoded in the .wav file. The range (1,1) is normal if you are considering a stream of fixed point values in Q1.xx format, where xx stands for the bits used to represent the decimals digits (e.g. Q1.15 for 16 bit numbers)
If you want a binary stream you have to convert the numeric array obtained by the wavread function from decimal to binary format (check in Mlab the usage of functions num2hex, num2bin, hex2bin or similar, sorry but I don't remember the exact names).
Be careful in specifying the quantizer when using those functions, to represent correctly the format used to acquire the samples.
Regards
Mowgli
2 members found this post helpful.

25th April 2010, 20:33 #5
 Join Date
 Dec 2004
 Posts
 759
 Helped
 114 / 114
 Points
 7,585
 Level
 20
Re: matlab convertion from .wav to binary
Originally Posted by mowgli
For example, a Q14.1 format number:
* requires 14+1+1 = 16 bits
* its range is [2^14, 2^14  2^1] = [16384.0, +16383.5] = [0x8000, 0x8001 … 0xFFFF, 0x0000, 0x0001 … 0x7FFE, 0x7FFF]
* its resolution is 2^1 = 0.5
http://en.wikipedia.org/wiki/Q_%28number_format%29
2 members found this post helpful.

Advertisement

27th April 2010, 20:19 #6
 Join Date
 Apr 2002
 Posts
 149
 Helped
 36 / 36
 Points
 3,506
 Level
 13
Re: matlab convertion from .wav to binary
Sorry for the disguise: Q1.15 is equal to Q15 definition found in Wikipedia
It defines 16 bit fixed point format with one sign bit and 15bits fractional part
1^B15 x Sum(2^Bn)
where B15 is MSB and B0 is LSB
So the range for this format is [1, 0.99996948242188] or which is represented by hex coded numbers in the range [0x8000, ox7FFF]. For simplicity this range is typically referred to as 1 to 1.
If you are curious try this in Matlab
q = quantizer([16,15])
hex2num(q,'7FFF')
hex2num(q,'8000')
num2hex(q,1)
num2hex(q,1)
num2hex(q,2)
num2hex(q,2)
Regards
Mowgli
1 members found this post helpful.
+ Post New Thread
Please login