How can i track the peaks in an audio file?
My intention is to track the beats and the peaks from a song and represent them in the "song graphic rappresentation" using dots or something like that.
In other words, I want to track and display in a "sound cloud graphic" the beats and peaks...
Do you have any idea on how to graphically draw the sound wave, track beats and peaks and display them in a graphical form?
Until now, I can just play a song using mediaplayer
MediaPlayer mediaPlayer = MediaPlayer.create(context, R.raw.sound_file_1); mediaPlayer.start(); // no need to call prepare(); create() does that for you
Accomplishing this goal hinges on whether you can obtain access to the raw samples that are being played. From reading up on the Android MediaPlayer class, I see that the second parameter of the create() method is a Uri class. It doesn't seem to give access to raw PCM samples. Have you subclassed another class from Uri, which you are passing through here? I see that the Uri class does not have a "raw" member.
I'm wagering that you want to play something like an MP3 or MP4 audio file, and not just a PCM WAV file? If you want to do visualization, then one way or another you will need to get access to a stream of raw audio samples. If you are determined to make this happen, you might need to incorporate your own audio decoding library so that you can do the heavy lifting yourself, just to get access to the raw bytes.