How to detect BPM of the song by programming

Discussion in 'Mac Programming' started by vavdiyaharesh, Mar 15, 2009.

  1. macrumors newbie

    May 15, 2008

    In my application, i have to detect all the songs and BPM og those songs. Detect the songs are finished now i have to detect BPM of songs.

    Does anyone tell me that how can i detect BPM of each song by programming in Cocoa.

  2. macrumors G4

    Jan 5, 2006
    Redondo Beach, California
    You have picked a hard problem. One that no one yet has solved completely. If you do this well you will be the first to do so.

    OK here is what you have to do. Stop thinking about programming and cocoa. How would YOU figure it out your self without a computer. Let's say you found a person who somehow had never heard music of any kind how would you tell him to find the BPM. Write down those instructions in detail.

    Good now you have about 10 or 20 steps all you have to do is write software for each of those steps.

    What you have shown by your question is that in order to write a non-trivial program yo need to know a lot about no only programming but the subject area too. For example how would you write an airplane flight simulator. You'd need to understand about the physics of flight and many other subjects. In your case you are going to have to learn about music and signal processing. Programming is the easy part.
  3. macrumors newbie

    Feb 2, 2008
    I will preface this comment by stating I have absolutely no experience with analyzing music via electronic devices or otherwise. ;)

    Perhaps you should look into counting drum beats per minute since they usually set the beat/pace for the song--however if the song doesn't use drums it might work so well. Besides counting drum beats, your other best bet might be to see what mathematical analysis has been done and if there are any existing algorithms that perform a similar function.
  4. macrumors 6502a

    Sep 3, 2005
    Cramlington, UK

    I've never done anything like this before but I was wondering if a low pass filter feeding a number of narrow band pass filters covering the range of bpm would do the trick. Pick the bpm of the filter with the highest output.

    b e n
  5. macrumors G5


    Jun 27, 2007
    A number of DJing software does it, some have component that allows users to tap the beats for BPM calculations.
  6. macrumors 6502a


    Oct 26, 2003
    Richmond, VA
    I think this kind of thing would be the easiest implementation by far from a programming standpoint. Clearly it's less optimal for the user than having the computer calculate it in the background, but it's going to be more accurate and won't have any of the issues of handling songs without a strong rhythmic bass/drum line (like a cappella singing for example). Of course if your user is anything like Steve Martin's character in "The Jerk" you may have problems :D.
  7. macrumors newbie

    Feb 2, 2008
    I think the only problem with this would be that it probably relies on having some sort of strong drum/baseline to set the beat for the song if it's anything like some of the DJ's I've run across recently.

    Or perhaps in a similar vein, try and seperate the different sources (vocals, instruments etc.) and then have the program look for the graph/audio range with the most consistent and constant beat -- even accapella has one. Might this be possible with something like Core Audio or OpenAL?

Share This Page