Class: Wavesync::Analyzer
- Inherits:
-
Object
- Object
- Wavesync::Analyzer
- Defined in:
- lib/wavesync/analyzer.rb
Instance Method Summary collapse
- #analyze(overwrite: false) ⇒ Object
-
#initialize(library_path) ⇒ Analyzer
constructor
A new instance of Analyzer.
Constructor Details
Instance Method Details
#analyze(overwrite: false) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/wavesync/analyzer.rb', line 11 def analyze(overwrite: false) unless BpmDetector.available? puts 'Error: bpm-tools or ffmpeg is not installed. Install with: brew install bpm-tools ffmpeg' exit 1 end @audio_files.each_with_index do |file, index| audio = Audio.new(file) if audio.bpm && !overwrite @ui.analyze_progress(index, @audio_files.size) @ui.analyze_skip(file, audio.bpm) next end bpm = BpmDetector.detect(file) audio.write_bpm(bpm) if bpm @ui.analyze_progress(index, @audio_files.size) @ui.analyze_result(file, bpm) end end |