Play Audio (mp3, ogg) from sd card with AudioTrack

最后都变了- 提交于 2019-12-03 16:19:08

From the following link i have found that AudioTrack only plays PCM audio, http://developer.android.com/guide/topics/media/index.html

And Please have a look on this code. http://mindtherobot.com/blog/624/android-audio-play-an-mp3-file-on-an-audiotrack/ this is provided the information about how to Play an MP3 file on an AudioTrack.

Hope this helps u .

The AudioTrack class only supports PCM audio data, that's why you're hearing noise.

Use MediaPlayer or SoundPool if you want to play compressed audio files like .mp3 and .ogg.
Alternatively you could decode the compressed audio in your app and write the resulting PCM data to an AudioTrack, but that's a much bigger task.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!