Thursday, April 03, 2008

Two types of AMR:

-----------------------

1.AMR or AMR_NB ( AMR narrow band) - Mono channels ( 8 bit audio)

2.AMR_WB ( AMR wide band) - stereo channels ( 16 bit audio)



we are using AMR_NB ;



Every AMR file begins with following Hex start codes:


23 21 41 4d 52 0a ( Equal string is: #!AMR.)


if we open the amr file, without these start codes means it will display like

---------------------------

Error

---------------------------

Error -2048: Couldn't open the file Quotes.amr because it is not a file that QuickTime understands.

---------------------------

OK

---------------------------

Every audio frame is having one byte frame header;


format is as follows:

---------------------------------------------

F ( 1 bit) | FT( 4 bits) | 1 ( 1bit)

---------------------------------------------




Frame Type

Mode

Frame Size(Including 1 byte header)

0

AMR 4.75

13

1

AMR 5.15

14

2

AMR 5.9

16

3

AMR 6.7

18

4

AMR 7.4

20

5

AMR 7.95

21

6

AMR 10.2

27

7

AMR 12.2

32



if we have a file with 12.2 kbps means, we can check this by the frame header;

and moreover we can note that every frame have 1 byte header;But it is same as start. Assume that first frame's header is 3C then every frame must begins with header start code ;

if the header is having proper start code and the next it will check whether every frame is having same header info; otherwise it will reports the error as follows:


"Quicktime media file is having incorrect duration"



I have to do one more check;

if every frame is having different header start code whether the QuickTime play that AMR file ?...


3C is a frame header for first frame;

38 is a frame header for second frame;

Both frame headers indicate the same Frame Type;

whether it will works ?


Result :

----------

it works fine;


Test case 2:

-------------------

Instead of 0x38, I inserted the 0x20.

Then I didnt get any sound while playing it in QuickTime player and moreover the Quicktime is not giving any errors;


Instead of 0x20, I made it as 0x20, then I faced the same problem.


Every AMR frame is having 20 ms of data;


So if 40 frames are available means


40 * 20 = 800 milli seconds( play time of that frames);


1000 milliseconds = 1 second

No comments: