From 708e08c3f3ab119231a1633ed21c30f3f9642c93 Mon Sep 17 00:00:00 2001 From: libraz Date: Sat, 31 May 2025 18:49:10 +0900 Subject: [PATCH] Fix BPM selection bug --- src/bpm_detector/music_analyzer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bpm_detector/music_analyzer.py b/src/bpm_detector/music_analyzer.py index d6448fc..173951d 100644 --- a/src/bpm_detector/music_analyzer.py +++ b/src/bpm_detector/music_analyzer.py @@ -77,7 +77,8 @@ def smart_choice( higher.sort(key=lambda x: -x[1]) if higher and higher[0][1] / total_votes >= THRESH_HIGHER: - rep_bpm = max(higher[0][0], higher[0][0]) + # choose the representative BPM of the strongest higher cluster + rep_bpm = higher[0][0] conf = 100 * higher[0][1] / total_votes else: rep_bpm = max(base_vals, key=lambda x: x[1])[0]