android最快的解码mp3到pcm数据的方法 [英] android fastest way to decode mp3 to pcm data
问题描述
在我的应用程序中,我需要将mp3文件解码为pcm缓冲区。这是很多数据,所以当我读取并解码时,我将它下采样到单声道22050Hz。
in my app i need to decode an mp3 file into a pcm buffer. that's a lot of data so i downsample it to mono 22050Hz as i read and decode it.
目前我正在使用javazoom jlayer解码器 http://www.javazoom.net/javalayer/javalayer.html
at the moment i'm using javazoom jlayer decoder http://www.javazoom.net/javalayer/javalayer.html
它的工作速度很慢,30秒用于在运行模式下解码3分钟的歌曲,在调试模式下老化。在我的Windows机器上使用libmpg我可以在大约1秒钟内完成。
its working but its slow, 30secs to decode a 3min song in run mode, ages in debug mode. on my windows machine using libmpg i can do that in about 1 second.
有没有人能确定更快的更快的方法?我不想浪费时间实施另一种方法,如果它没有明显更快。谢谢。
is there a faster way that anyone knows for sure is faster? i don't want to waste time implementing another method if its not significantly faster. thanks.
顺便说一句,在我的应用程序中,我需要将整个内容下载到内存中的pcm缓冲区,所以我对只播放mp3文件的东西不感兴趣。
by the way, in my app, i need the whole thing downloaded to a pcm buffer in memory so i'm not interested in things that simply play mp3 files.
推荐答案
这是你在Android中使用Native的时刻!
This is the moment when you go Native in android!
- 使用NDK并找到一个快速的c / c ++库(它们比jlayer快20倍,例如18秒内9min sogn)
-use NDK and find a fast c/c++ library (they are like 20x faster than jlayer, for example 9min sogn in 18sec)
- 有些库是可以是有用的:
-here are some libs that can be usefull:
www underbit.com/products/mad /
www underbit.com/products/mad/
www oracle.com/technetwork /java/javase/download-137625.html(不确定这个支持MP3toPCM)
www oracle.com/technetwork/java/javase/download-137625.html (not sure does this one supports MP3toPCM)
lame.sourceforge.net/about.php(这个有一个android开源我希望github上的项目对你非常有用!
https://github.com/ intervigilium / liblame )
lame.sourceforge.net/about.php (this one has an android opensource project on github that i hope is going to be very usefull to you! https://github.com/intervigilium/liblame)
这篇关于android最快的解码mp3到pcm数据的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!