Hi all,
I'm trying to play raw PCM in assets using AudioTrack, but I couldn't
seem to get it right. This is how I generate the raw PCM on my
computer:
ffmpeg -i sample.aif -ac 1 -ar 22050 -f s16le sample
I've also tried the following formats, but all I can get is a noisy
distorted sound.
s16be PCM signed 16 bit big-endian format
s16le PCM signed 16 bit little-endian format
u16be PCM unsigned 16 bit big-endian format
u16le PCM unsigned 16 bit little-endian format
Here's my code for initializing AudioTrack.
mTrack = new AudioTrack(
AudioManager.STREAM_MUSIC,
22050,
AudioFormat.CHANNEL_OUT_MONO,
AudioFormat.ENCODING_PCM_16BIT,
AudioTrack.getMinBufferSize(
22050,
AudioFormat.CHANNEL_OUT_MONO,
AudioFormat.ENCODING_PCM_16BIT
),
AudioTrack.MODE_STREAM
);
Thank you for any assistance.
--
Regards,
Joseph
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en