Welcome!

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

Reply
Contributor
Posts: 34
Registered: ‎02-28-2010
My Device: 8800
My Carrier: at&t

Audio Recording at higher bit rate than AMR encoding

I'm trying to get an Audio recording that has more data (bits / sec) than the default AMR which was giving me a lousy 12.2kbps for 1525 bytes / sec.  I did find and try using    &rate=X   in my createPlayer statement but no higher rates seem to work.  

 

What I found says PCM is 8k/sec of 16bit data.  So if I use the sample audio recording code, which is all BYTE sized data, would I just take the byte output array and convert it to short like so:

     short array[0] = output[0] << 8 + output [1];

 

or is there a better way than having to convert the byte output stream?

 

or does someone have yet another option that would be faster still?  the   rate=X   doesn't seem to do anything for PCM either.

 

I'm on 4.5JDE since my device is 8800 series.  I would like to get 44,100 bytes per second if possible but if not I want to get the max I can since I am doing audio analysis looking for specific noises.

 

Thanks,
Craig

 

 

 

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Audio Recording at higher bit rate than AMR encoding

[ Edited ]

1. AMR(-NB) doesn't support modes higher than 12.2kbps.

 

2. Keep in mind that PCM recording might not always be available (for example, I hear it's not available on CDMA-capable BlackBerrys such as the Storm).

 

3. Keep in mind that "byte" and "short" data types are signed in Java. So, your two-byte-to-short code is probably wrong. If you're dealing with unsigned 16-bit big-endian PCM, something like this should do it:

 

 

final int sample = ((firstByte & 0xFF) << 8) | (secondByte & 0xFF);

 

 

Highlighted
Contributor
Posts: 34
Registered: ‎02-28-2010
My Device: 8800
My Carrier: at&t

Re: Audio Recording at higher bit rate than AMR encoding

Thanks for the reminder about being signed values Smiley Happy

 

Craig