Hello everybody.
I’m a french developper, so, I’m sorry for the English mistakes that I will make.

I’m developping a music player which sort the music by the BPM, to make a playlist where the songs sound as the same. But I can’t find the BPM of the songs…
I find an algo on the internet which calculate the energy of the song on one second, and on 1/43 of second (centered on the second calculate previously) and, if the energy of the 1/43 of second is superior to 1.3 times the energy of the second, then, there is a beat. I make this, during all the song and I divide by the length of the song. Nevertheless, I never find a good result.
So I make a very simple sound with audacity. A long silent, with a beat every 1/2 second. I export it as MP3 and as WAV.

To determine the energy, I lock the sound with :
[code:1boedniz]FMOD_Sound_lock(Sound, position, 44100, &SoundData, &unused1, &Datalength, &unused2);[/code:1boedniz]
And I have to make the mean of the square of each sample (casts in a int).

But when I look what is there in SoundData, I don’t find [0..0, some values for the beat, 0..0] like I think there must have… (I think that this sentence isn’t a good sentence ^^ Do you understand what I want to explain?)

I read some topics where they write that to use Sound::lock, the sound must be created with FMOD_CREATESAMPLE. Here I create my sound with this :
Is it normal that the data doesn’t contains only 0 except for the beat. Have you an other/easier idea to make a best Beat Detection.

Sorry for the English mistakes.
Ask me more informations, if you need.

Thanks for help me.


  • You must to post comments


I think there are a few ways of going about what you are trying to do.

First and foremost, check out SoundTouch – it’s an open source BPM and sound stretching library, C++ based.

For one, if you don’t need to play the audio while you are analyzing it, you can use FMOD to just read the files you give it and pipe it into your BPM detection library.

If you need to play the audio while you are analyzing it, then I would suggest one of the following two methods:

Create a DSP callback that takes the audio and sends it to your BPM detection library.
Create a separate thread that loads the audio file and reads it, sending all the data to your BPM detection library.

I believe FMOD provides sample code to create your own DSP callback as well as open audio files just for reading.

Good luck!

  • George
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.