Class: Wavesync::BpmDetector
- Inherits:
-
Object
- Object
- Wavesync::BpmDetector
- Defined in:
- lib/wavesync/bpm_detector.rb
Constant Summary collapse
- CONFIDENCE_THRESHOLD =
2.0
Class Method Summary collapse
-
.available? ⇒ Boolean
: () -> bool?.
-
.detect(file_path) ⇒ Object
: (String file_path) -> Integer?.
Class Method Details
.available? ⇒ Boolean
: () -> bool?
12 13 14 |
# File 'lib/wavesync/bpm_detector.rb', line 12 def self.available? EssentiaBpmDetector.available? || PercivalBpmDetector.available? end |
.detect(file_path) ⇒ Object
: (String file_path) -> Integer?
17 18 19 20 21 22 23 24 |
# File 'lib/wavesync/bpm_detector.rb', line 17 def self.detect(file_path) if EssentiaBpmDetector.available? essentia_result = EssentiaBpmDetector.detect(file_path) return essentia_result[:bpm] if essentia_result && essentia_result[:confidence] > CONFIDENCE_THRESHOLD end PercivalBpmDetector.detect(file_path) if PercivalBpmDetector.available? end |