how to extract beats from a piece of music

3

2

I am working on a guitar hero like game prototype. and now I am looking for a tool that is able to extract the key beats of a song in addition to the height of the tune. is there something like this?

clamp

Posted 2009-09-26T11:01:13.800

Reputation: 1 074

what do you mean by "height"? are you referring to amplitude? – Joshua K – 2009-09-26T17:20:07.350

4just as another tip, you're probably going to need to learn a little about the math, physics, harmonic relationship, and concepts behind waveforms in order to expertly accomplish what you're looking to do with regards to the big picture of the game. good luck. stackoverflow will be a helpful resource.

Also, as far as beat extraction, look at ReCycle by Propellerheads and the beatslicer included in FruityLoops. I'm sure there are open source analogs. – Joshua K – 2009-09-26T17:24:14.267

By 'beats' are you referring to Beats-Per-Minute (BPM)? or are you actually trying to extract the 'notes' from the song? Would those notes be from a piano? guitar? drums? cymbals? Each likely has a very different waveform pattern. An interesting challenge indeed! If just BPM, there seems to be several tools that do this out there. Please clarify – ericslaw – 2009-09-27T04:01:12.740

i am refering to the notes. and for the instrument, yes it may be any of those. usually the most significant one. if you played guitar hero, those notes are what i need as data. – clamp – 2009-09-28T17:52:55.187

You sound confused. "Extracting beats" and "extracting notes" are totally different things. Anyway, this sounds like a question for Stack Overflow: http://stackoverflow.com/questions/657073/how-to-detect-bpm-of-the-song-by-programming http://stackoverflow.com/questions/294468/note-onset-detection http://stackoverflow.com/questions/761397/convert-wave-to-musical-notes

– endolith – 2009-10-11T15:33:00.070

Answers

4

To do this, you can invert the signal and then add them together. This extracts most vocal elements. Then use EQ to filter any remaining artifacts. This is usually effective in stripping it down to the beat. You'll have the hardest time maintaining the integrity of the extreme high's in hi-hats using this method, but it'll still sound good.

Here are more details:

Joshua K

Posted 2009-09-26T11:01:13.800

Reputation: 771

I suspect you know what you're doing, but this description doesn't make sense. A+(-A)=0, no? Perhaps you could be a little more precise. – dmckee --- ex-moderator kitten – 2009-09-26T17:09:37.167

I have added links demonstrating the technique and more. – Joshua K – 2009-09-26T17:15:17.797

1Aha. Stereo folding, which means it works with many but not all tracks. Very good. – dmckee --- ex-moderator kitten – 2009-09-26T17:17:54.047

rockbox.org 'karaoke' mode does exactly this on my sansa mp3 player. It removes the 'shared' waveforms between the left and right stereo sound, because 'most' song mixes have vocals in the center. – ericslaw – 2009-09-27T03:55:16.310

You mean "invert one channel of a stereo sound file", and this doesn't remove "vocal elements", it removes anything that's common to both channels. And it's a very poor way to estimate the beat. – endolith – 2009-10-11T15:27:02.533

3

If you use Audacity, you should be able to see what you want.

alt text

If you are talking about actual integrating this into your program, your question would be better on Stack Overflow.

William Hilsum

Posted 2009-09-26T11:01:13.800

Reputation: 111 572

thanks! well what i want is to redirect the output to some datafile that can be used by my program. – clamp – 2009-09-26T13:44:24.750

2The picture doesn't help because it doesn't tell how to accomplish the task. The link is just a link to software. It is like a guy asking how to build a house and being handed a hammer. He is going to need it, but it doesn't answer the question. – Joshua K – 2009-09-26T17:18:12.487

Well, thanks a lot for that... I did not know exactly what he wanted from his original question and I thought he just wanted to visualise it and then build a program around it... for example, I can clearly see where the peaks are with relation to time. – William Hilsum – 2009-09-26T17:36:30.093

2

You should look at The Echo Nest's Analyze API. It's pretty easy to get an API key, and then you can just call the get_beats API. (Disclaimer: I've worked on the Analyze API for The Echo Nest).

If you are looking for code that you can run locally and modify, you might want to check out Marsyas.

Jason Sundram

Posted 2009-09-26T11:01:13.800

Reputation: 2 946

The Echo Nest API no longer works unfortunately. – dionyziz – 2017-01-16T01:15:56.990

1

Just use the BeatBox - Drum replacer http://mda.smartelectronix.com/ you can feed it audio, help it identify the different drum components via sliders and then map your drum sounds to the beat you just ripped. easy.

George Reagan

Posted 2009-09-26T11:01:13.800

Reputation: 11