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

Answers


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.


Need Your Help

Constant bugs from [NSArray count] being unsigned

objective-c for-loop int nsarray

I'm creating bugs over and over by failing to notice the consequences of [NSArray count] being unsigned. Today's example is relatively unusual:

Is it possible to find out whether a process was started by a user or by another process via CreateProcess or ShellExecute?

winapi process operating-system pid

I wanted to know if there was any way of checking if a particular process was started by the user by him/her double clicking, typing the required commands in cmd, via the address bar in explorer, e...