MTG / essentia

C++ library for audio and music analysis, description and synthesis, including Python bindings
http://essentia.upf.edu
GNU Affero General Public License v3.0
2.85k stars 533 forks source link

Determining first beat in a measure #253

Open KyleKotowick opened 9 years ago

KyleKotowick commented 9 years ago

I'm pretty new to Essentia but am quite impressed with it. There's one feature that I'm hoping someone can help me figure out (if it's even possible). Using RhythmExtractor2013 I can get the times of all beats in the song, and it's quite accurate. Is there any way, though, to find which beats are the first in each measure? e.g. beat 1 of a measure in 4/4 time.

Thanks! Keep up the great work.

dbogdanov commented 9 years ago

It is not possible with the algorithms we currently have. This feature is in our wishlist. You can experiment with RhythmExtractor2013, if the music you analyze is 4/4, potentially the first beat in the list will often correspond to the first downbeat, but we did not evaluate that.

KyleKotowick commented 9 years ago

Good to know that I'm not crazy, and it doesn't actually exist. I've tried it with different songs, and the RhythmExtractor2013 will start on the first beat < 50% of the time. Is there a way to see the "wishlist", and what priorities things on it have?

georgid commented 7 years ago

We plan to reimplement a state of the art beat and downbeat detection algorithm

PatternTrackingProcessor class is the main downbeat tracker class. It is based on a dynamic Bayesian network (DBN) approximated by a Hidden Markov Model (HMM) for computationally faster decoding. The states of the HMM track a hypothetic pointer to a position in a metrical cycle (bar). The observation model for each state comes from pre-trained rhythmic pattern (a sequence of GMM models) per each given meter type (e.g. 4/4) that is based on the spectralFlux onset feature.

A script that runs the entire detection process The PatternTrackingProcessor class is called in downbeat_processor = PatternTrackingProcessor(**vars(args))

Essentially the script does:

  1. create the efficient joint bar-tempo state space
  2. extract the spectral flux
  3. load the pre-trained rhythmic patterns into the GMM observation model
  4. decode the states with Viterbi and convert them into beats
georgid commented 7 years ago

@dbogdanov may you point me to the implementation of the Viterbi decoding algorithm for HMM in essentia? I need to review it.

dbogdanov commented 7 years ago

@georgid Check this algorithm: https://github.com/MTG/essentia/blob/master/src/algorithms/rhythm/tempotapdegara.cpp

georgid commented 7 years ago

The Viterbi algorithm from the existing beat tracking implementation can be reused. The Viterbi in madmom is here

The transition matrix is madmom is implemented in the transition model class which is based on the joint bar-tempo state space

georgid commented 7 years ago

Let me know if u have questions about the paper effocient state space for joint beat wnd meter tracking from malaga ismir. El 8/5/2017 1:06 p. m., "Dmitry Bogdanov" notifications@github.com escribió:

@georgid https://github.com/georgid Check this algorithm: https://github.com/MTG/essentia/blob/master/src/algorithms/rhythm/ tempotapdegara.cpp

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/MTG/essentia/issues/253#issuecomment-299838437, or mute the thread https://github.com/notifications/unsubscribe-auth/AFWjaplRzgyAkfZckpCqPs58wCd-IDSNks5r3vdKgaJpZM4ES9go .

declension commented 5 years ago

Was there any progress with this? I'd love to see downbeat / bar tracking in Essentia

Be-ing commented 4 years ago

@georgid @pabloEntropia has there been any progress on this? We're looking to implement this feature in Mixxx along with phrase and section detection and considering using Essentia. If Essentia had this in the library that would be a big help. From what I gather from the old posts in this thread, you were intending to reimplement the downbeat detection algorithm from Madmom in C++ for Essentia? Please correct me if I misunderstood that. If that's the case, perhaps we could help to get that upstream in Essentia instead of rolling our own.

Cc @crisclacerda