Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to figure out song's patterns (rythm) using AS3 SoundMixer.computeSpectrum? [closed]

Right now, I'm working on trying to figure out a song's patterns (rhythm) to represent them visually. So, for example, the main beat of a song (drums) would be a red square, the secondary beats (bass) blue circles, etc. So each of them shows up every time their respective beat sounds.

I know a song's could have a lot of patterns (beats), and that's the reason I'm having problems. Right now I'm trying to get only the main beats. I'm trying to solve it this way:

I'm using SoundMixer.computeSpectrum to get a ByteArray made up by a intensity/frequency spec. This ByteArray is feed every 1/10 second. I'm trying to group similar intensity/freq data in Dictionaries to figure out the song's patterns.

A figure that explains it better.

I'm getting patterns by:

  • Families (the whole int/freq spec each 1/10): However, to get a Family getting repeated in a song is really rare. Practically never happens.
  • Family Member (individuals int/freq ids): The family members are commonly repeated, but alone, they are useless.
  • Family Member Twin Brothers (group of family members that always sounds together): This is working, but I'm getting A LOT of groups of twin brothers, so is really difficult to analyze them and figure out which ones are the main beats.

Do you know if there is a better way to figure out song's patterns (rythm) using AS3 SoundMixer.computeSpectrum or any other object/framework/api?

PD: I have no music theory advanced acknowledgments.

like image 965
Nestor Villalobos Avatar asked Nov 04 '22 04:11

Nestor Villalobos


1 Answers

Julapy posted a demo and code that detects some obvious beat. Julapy aggregates energy from computeSpectrum. Julapy aggregates over a broad frequency band, not co-ocurring narrow bands (family members): http://www.julapy.com/blog/2007/12/30/beat-detection-in-flash/

Honestly, I have never coded the algorithms below, yet page 2 of an article "Beat Detection Algorithms" suggests estimating beats per minute by estimating periods of the same frequency band. It sounds like you could augment Julapy's approach: http://archive.gamedev.net/archive/reference/programming/features/beatdetection/page2.html

By the way, the sound analyzer demo and code in the HYPE framework also visualizes computeSpectrum in novel ways. While not solving the same problem, the code related to computeSpectrum may be worth reading: http://www.hypeframework.org/02_examples/soundanalyzer/content/01_soundanalyzer/

like image 146
Ethan Kennerly Avatar answered Nov 09 '22 10:11

Ethan Kennerly