Search code examples
androidaudioandroid-ndkoboe

How to pre-computing mp3 file on Android?


I have to make a visualizer app. I'm doing this using AudioPlayer and AudioManager class and drawing the miusic wave using canvas. But the problem is that I have to play the music! I need to draw the music waves and save them as pngs in sd card without playing the music. I'm thinking about Oboe library but I can not find any think to help.


Solution

  • Oboe won't help you with this as it's just for playing audio. What you need to do is

    • Extract/decode the MP3 into PCM.
    • Convert the PCM values into an image.

    Here's some ideas:

    • You could use audiowaveform
    • For just doing the MP3 extraction you could use the Oboe RhythmGame sample code here