Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix situation where beats get detected multiple times #298

Merged
merged 1 commit into from
Jun 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Version 0.16.dev0
Bug fixes:

* Fix `TransitionModel` number of states when last state is unreachable (#287)
* Fix double beat detections in `BeatTrackingProcessor` (#298)

Other changes:

Expand Down
8 changes: 4 additions & 4 deletions madmom/features/beats.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,10 @@ def process(self, activations, **kwargs):
positions = detect_beats(act, interval, self.look_aside)
# correct the beat positions
positions += start
# remove all positions < already detected beats + min_interval
next_pos = (detections[-1] + self.tempo_estimator.min_interval
if detections else 0)
positions = positions[positions >= next_pos]
# search the closest beat to the predicted beat position
pos = positions[(np.abs(positions - pos)).argmin()]
# append to the beats
Expand All @@ -534,10 +538,6 @@ def process(self, activations, **kwargs):
detections = np.array(detections) / float(self.fps)
# remove beats with negative times and return them
return detections[np.searchsorted(detections, 0):]
# only return beats with a bigger inter beat interval than that of the
# maximum allowed tempo
# return np.append(detections[0], detections[1:][np.diff(detections) >
# (60. / max_bpm)])

@staticmethod
def add_arguments(parser, look_aside=LOOK_ASIDE,
Expand Down