03-01-2010 12:25 AM
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 = output << 8 + output ;
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.
03-01-2010 03:06 AM - edited 03-01-2010 03:09 AM
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);