Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

programmatically get BPM of a wave or MP3 from .Net

I have a project with a requirement to get the BPM of a wave or MP3 file programmatically using .Net (VB.Net or C#).

Does anyone know of a binary or library for this or have a code snippet to steer me in the right direction?

like image 380
Robert Avatar asked May 06 '10 14:05

Robert


3 Answers

For the part where you get the samples from WAV or MP3 in .NET code, I use NAudio (at CodePlex), free, usable in commercial apps, no real documentation, just sample code.

like image 93
Conrad Albrecht Avatar answered Nov 17 '22 11:11

Conrad Albrecht


First, if you want to do sound with .Net, I would recommend fmod which is awesome and has a .Net wrapper (http://www.fmod.org).
Next, to get the BPM there are several methods but the one I find the most effective is the "beat spectrum" (described here: http://www.rotorbrain.com/foote/papers/icme2001/icmehtml.htm).
This algorithm computes a similarity matrix by comparing each short sample of the music with every others. Once the similarity matrix is computed it is possible to get average similarity between every samples pairs {S(T);S(T+1)} for each time interval T: this is the beat spectrum. The first high peak in the beat spectrum is most of the time the beat duration. The best part is you can also do things like music structure or rythm analyses.
If you are interested in this field, I would suggest to read other Jonathan Foote papers.

like image 2
jeremy-george Avatar answered Nov 17 '22 12:11

jeremy-george


Here's a commercial product that has a C# library. A trial is also available: http://adionsoft.net/bpm/

like image 1
Dinah Avatar answered Nov 17 '22 12:11

Dinah