Analysis of sound waves from an MP3 file and representation

4

Is there any way in Java / Android to open an MP3 or WAV file and from there get the sound waves constantly? according to its reproduction? and can from that constant return make your graphical representation?

Example 1:

Videowiththedesiredobjective: link

    
asked by anonymous 11.02.2017 / 16:40

2 answers

4

I already have an answer and several comments, I took a quick look at the libraries that were proposed just for curiosity, but unfortunately none of them really do what you seem to need: - (

Do not look for equalizer an equalizer has the function of attenuating or emphasizing a specific frequency or a set of them (frequency band), you are looking for Audio spectrum Analyzer each frame of processed audio is analyzed by < fourier transform is the magic.

I do not know java libraries, I just know how to do it, maybe explaining you can understand the steps needed.

  • You will need to decode your mp3 audio, this process allows you to digitally represent sampled analog signals, that is to say you will have pure audio, you will have all the values of the sampled signal amplitude in a certain range. li>
  • In a concurrent way, you analyze each piece of audio while it plays, it usually uses pieces of size with power of two, this simplifies and gives performance gain along the fourier transform, I do not want to go into deep, thick mathematics so the fourier transform decomposes a signal into spectral components (frequencies).
  • With the representation of the frequencies of each sample you must plot or draw the values to achieve the effect you want.

Long ago I did this algorithm in python to test, in fact have some details on how you need the effect to be, the larger the window passed to fourier the lower the resolution order of the spectral components, but of course this has a computational cost and you will need to decide on a window size that is the best cost benefit for the your app.

The example you showed just by looking at the graph shows that it works very well with the low frequencies, but has almost no interaction with the treble, notice the minute 2:05 , a voice begins and the spectrum analyzer has almost no changes, this tells me that the algorithm is only demonstrating more serious frequency bands ...

    
15.02.2017 / 02:17
1

There are two libraries that can do this for you: MiniEqualizer and

They have the same effect and if you look at their source code, you will see that they inherit from a View , which gives you the ability to edit and do something similar to the video.

In this case, you would have to synchronize View with your Player .

Other alternatives : WaveInApp , Horizon

    
11.02.2017 / 17:10