atuline/WLED

improve beat (onset) detection

softhack007 opened this issue · 4 comments

As part of the discussion in other problem reports, users have asked for beat detection. This issue ticket is meant to collect availeable information that could be useful for a future implementation.

Actually I already have a working prototype for beat detection based on the "beatroot" algorithm. However there might be other ways to achieve the desired function and I'm open to discussions.

The basic idea is:

  • use a Short-time FFT as starting point (we already have that)
  • Sum the increases in magnitude over all frequencies (ignore the decreases). This gives you a function called the "spectral flux".
  • Find the peaks of this spectral flux. These so-called "onsets" correspond to the start of sounds in the music (notes, drum hits, voice onsets, etc).

Screenshot_20220813-014757_Firefox Beta


Another idea, as @atuline wrote in #209

Damian peckett had a nice beat detection article on his web site a while back, but unfortunately, that site is no longer available. Beat detection, however, is not an easy thing to implement, as is the automatic gain control.
I shlurped most of the information from that article, including the code if @softhack007 is interested.


some links:

Please add any ideas, expectations or anything that might be related.

Hmm...I presume you're talking about the URL mentioned here on Adafruit, which is http://dpeckett.com/beat-detection-on-the-arduino. Through some Wayback Machine sleuthing, I think https://web.archive.org/web/20181202114804/http://damian.pecke.tt/beat-detection-on-the-arduino might be the post you're looking for?

Hi, i was actually thinking about something FFT based. However your links are also interesting 👍Let's see what the result will be.
I have a prototype already that is based on recommendations from the "beatroot" science papers. It is an approach without filtering - its computing the "spectral flux" over time from FFT results, and then applying some heuristics to find major peaks in the flux.
Maybe your references will add something special to my final implementation, so really thanks sharing 😃

@softhack007 You're welcome! Did nothing but use archive.org to help find a copy of a post mentioned above which sounded like it'd help.

hi @softhack007 thank you for sharing, do you think same could work for speech onset detection?