Hacker News new | past | comments | ask | show | jobs | submit login
Beat Detection Using JavaScript and the Web Audio API (beatport.com)
92 points by hieronymusN on Aug 1, 2014 | hide | past | favorite | 11 comments



What is the corner frequency of the low-pass filter? It is kind of pointless to use a filter without specifying its corner frequency.

Also, peak detection can be improved a lot by searching for local maxima of the level instead of taking a threshold of the amplitude.

As a scientist of acoustics, I find this approach frustratingly naive. Still, nice write-up!


Thanks! re: corner frequency, ha, yeah I maybe oversimplified the example code a bit. That code will, however, work, because the Web Audio API specifies a default frequency of 350Hz ( http://webaudio.github.io/web-audio-api/#attributes-17 ). You can also dig into the source code of the page for the code that makes the audio examples happen (search for "click", which will give you the click handlers).

I think we'll circle around and try again in a less naive way :)


Yeah it was a little odd there was no specified frequency, the api must have a default to around just above a typical kick drum peak.


Nice write-up. Thanks!

I wonder if the algorithm can adapt to recordings where the tempo isn't quite constant.

Amusingly, I first read "beat" as a verb in your title, and was expecting something cloak-and-dagger.


Thanks! I think the answer is that it would fall down pretty hard if the tempo started varying, the reason being that the algorithm seeks out interval modes instead of averages, with only a little wiggle room.

In the testing section, the songs that we fail to identify correctly are usually those we couldn't get a "handle" on in the form of identifying common intervals. A varying tempo would exacerbate that problem.

Additionally, the question becomes: what is the tempo of a song that has an inconsistent tempo?


Not gonna lie I thought this at first. Assumed it was something that looks through news reports and looks for assault cases or something similar.


Thanks for this write up, I really enjoyed it. +1 to the suggestion to adjust the threshold based on the average volume in a section, maybe using a sliding window.


Nice! I'm trying to convince my brother to use similar techniques in his game to allow the environment to respond to music played by the user.


A really nice article, but not really an advanced algorithm. What would be really interesting is an explanation of something like Ableton warp engine, which can automatically detect and warp to the grid tracks with fluid tempo.


Wow, in my half-awake state I initially read that as 'BEAR detection using JavaScript and the Web Audio API". Unfortunately the article did not live up to the promise.

j/k, very cool :)


Bears, beats... Battlestar Galactica?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: