Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

New Contributor
Posts: 7
Registered: ‎02-24-2011
My Device: Bold 9700

AMR Recording

We are trying to build a SIP client on the BB. We get from the documentation that amr is supported but there are several things that we can’t figure out from the doc itself, because either is not clear or because the names they use are not the same ones used on the telephony world among other things:

1-      From this link http://download.oracle.com/javame/config/cldc/opt-pkgs/api/mm/jsr135/javax/microedition/media/Manage... we get these explanations, but we do not know if “rate” means “sampling rate” or “bitrate”, if we should use signed or unsigned (I would expect unsigned with 8 bits). Also amr is not described here:



Describing the audio encodings:


     audio_encodings = audio_enc_param *( "&" audio_param )

     audio_enc_param = "encoding=" audio_enc

     audio_enc       = "pcm" / "ulaw" / "gsm" / content_type

     audio_param     = "rate=" rate /

                       "bits=" bits /

                       "channels=" channels /

                       "endian=" endian /

                       "signed=" signed /

                       "type=" audio_type

     rate            = "96000" / "48000" / "44100" /

                       "22050" / "16000" / "11025" /

                       "8000" / other_rate

     other_rate      = pos_integer

     bits            = "8" / "16" / "24" / other_bits

     other_bits      = pos_integer

     channels        = pos_integer

     endian          = "little" / "big"

     signed          = "signed" / "unsigned"

     audio_type      = bitrate_variable / other_type

     other_type      = alphanumeric

     pos_integer     = 1*DIGIT



     content type is given in the MIME syntax.


    Example:     encoding=pcm&rate=11025&bits=16&channels=1


2-      When the player or microphone object gets the voice packets and put them on the buffer or stream object, if there any mini-header to strip before the actual payload (actual voice packets)?

If so, is it only the first packet with that header to strip? -> 0x23, 0x21, 0x41, 0x4d, 0x52, 0x0a


3-      Is this amr encoding narrow-band, wide-band?

4-      Also since amr has several modes, can we set the mode or at least which modes are supported and how to set them?

5-       We assume that we should use 8000 sampling rate, big endian, 8 bits only to represent the sample size but about the mode, bitrate etc?


We expect to send 31 bytes at a time, every 20 ms, for amr mode 7 (12.2 kbps). Please if somebody has gone through all this hurdle and can enlighten us we would really appreciate it.


Txs a lot

Posts: 49
Registered: ‎12-16-2010
My Device: 9700
My Carrier: Vodafone

Re: AMR Recording


 1- rate is for the bitrate. AFAIK you will only be able to record AMR at 12,2 kbps with capture://audio?encoding=amr" however seems there are no problems to  play other bitrates

2-  Those 6 bytes mark the beggining of an AMR file.  I believe for the frames you will have a header of only 1 byte. About those 6 bytes you attach i'm not sure even if they need to be transmitted at the beggining as you are sending an RTP stream

3- AFAIK only narrow band is supported

4- To select mode, if supported by the device, you would only need to play with some parameters :

player = Manager.createPlayer("capture://audio?encoding=amr&rate=5150") 

However before saying a rate is supported confirm it with the real device. Would be nice if someone can give light on which rates are supported by devices because it is a big headache Smiley Happy