4

I'm currently working on an idea for a game i have that involves beat detction. Th engine im working with is Unity, and I've never had any experience with audio, coding wise, so be gentle :)

I've looked at several articles and tested out several algorithms including some of my own, but none we're really successful nor accurate enough, and i feel like I've been getting something wrong this entire time.

Specifically I've tried implementing the idea's presented here: http://archive.gamedev.net/archive/reference/programming/features/beatdetection/index.html

but with little success, i still think im skipping over something and i cant quite pinpoint it.

If someone could provide an explanation about how to make an actually accurate beat detector i would be very grateful.

EDIT: some people were confused as to what im having trouble with. Here is my latest try at detecting beats, i still dont understand why it's so inaccurate: http://pastebin.com/BD8y9tfz

in this i used (R1) equation in the link i posted above to compute the instant energy from the 1024 samples i took, and then i used (R3) to calculate the local average sound energy from the buffer containing all the previous instant energy calculations, then i checked if there is a significant rise in instant energy compared to the average local sound energy, if there is, it means there is a beat, if there isn't, the program continues as usual.

(stupid reputation system doesnt let me post links and pictures ): ).

Edit 2: added implementation for R4,R5 and R6, still not working though. added a bit of debug, and for some reason the constant is ridicolosely small, numbers like:

Constant: -103416

and Constant: -54793.28, ive got no clue why im getting these numbers, any help?

Daedalus
  • 195
  • 1
  • 3
  • 15
  • 1
    Just a short note: This is seriously tough stuff, unless you decide on some sort of cheating, which would have to make use of things you know about the audio sources you will use. You may want to start reading up on Fourier analysis.. – TaW Jun 22 '14 at 23:28
  • tough and as a question too broad for stackoverflow – CodeSmile Jun 23 '14 at 00:29
  • @LearnCocos2D What exactly do you need me to expand upon? Beat detection is a pretty consistent subject, there aren't too many variants, its just that the base subject is waaaaay too difficult to get into. Tell me what im asking is too broad, i might be able to narrow it down a bit. – Daedalus Jun 23 '14 at 00:39
  • Many of the beat/bpm estimation algorithms involve either much fine tuning, either manually (which requires serious knowledge of the algorithm internals) or via machine-learning. Try reading some of the research papers over at MIREX/Music-IR. – hotpaw2 Jun 23 '14 at 04:52
  • 1
    @CakeToppings question being "how to make an accurate beat detector" leaves everything open, it's a broad question in the same sense as "how to make a match-3 game?". You may want to explain where exactly in your implementation you experience issues, like "I'm skipping low-volume beats with this algorithm". Point being that the question should be about an issue in your code rather than a general approach/solution if the topic is as difficult and almost scientific as beat detection. – CodeSmile Jun 23 '14 at 07:30
  • @LearnCocos2D tried to narrow it down, is it clear what im having trouble with now? – Daedalus Jun 23 '14 at 10:19
  • added a major update, still not working though, also getting some weird numbers. No idea why though. – Daedalus Jun 23 '14 at 19:10

0 Answers0