开发者

Getting PCM data from MP3 on Android

I am interested in doing some music analysis on the Android platform. To do this, I want to parse an arbitrary MP3 into PCM data. I've looked around and there doesn't seem to be an easy way to do this. One solution I've tried is using jLayer. This works, but it is incredibly slow, decoding the song in the 开发者_如何学JAVAsame time it takes to play it.

I know there exists an MP3 decoder on Android, Google says so itself under supported media types. Does anyone know how to use the Android decoder to decode an MP3 without actually playing it? All I want to do is divert the bits away from the DAC and store them in some buffer instead.

Alternatively, has anyone had any success using the NDK and something like MAD? Are the performance gains that good?


You can compile and use LAME decoder. It works fine on ARM. And since its C/C++, performance would be better.

Hardware decoder on most ARM platforms are geared towards playback. So would not give you perfect PCM. E.g., to avoid jitter it would skip some data if load is high.

Instructions on compiling LAME are:

Lame MP3 Encoder compile for Android

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜