lib/beats/beats_runner.rb
# Each pattern in the song will be split up into sub patterns that have at most this many steps.
# In general, audio for several shorter patterns can be generated more quickly than for one long
# pattern, and can also be cached more effectively.
Each pattern in the song will be split up into sub patterns that have at most this many steps.
In general, audio for several shorter patterns can be generated more quickly than for one long
pattern, and can also be cached more effectively.
Each pattern in the song will be split up into sub patterns that have at most this many steps . In general audio for several shorter patterns can be generated more quickly than for one long pattern and can also be cached more effectively .
def run
      base_path = @options[:base_path] || File.dirname(@input_file_name)
      song, kit = SongParser.parse(base_path, File.read(@input_file_name))
      song = normalize_for_pattern_option(song)
      songs_to_generate = normalize_for_split_option(song)
      song_optimizer = SongOptimizer.new
      durations = songs_to_generate.collect do |output_file_name, song_to_generate|
        optimized_song = song_optimizer.optimize(song_to_generate, OPTIMIZED_PATTERN_LENGTH)
        AudioEngine.new(optimized_song, kit).write_to_file(output_file_name)
      end
      {duration: durations.last}
    end
def run base_path = @options [ :base_path ] || File . dirname ( @input_file_name ) song , kit = SongParser . parse ( base_path , File . read ( @input_file_name ) ) song = normalize_for_pattern_option ( song ) songs_to_generate = normalize_for_split_option ( song ) song_optimizer = SongOptimizer . new durations = songs_to_generate . collect do | output_file_name , song_to_generate | optimized_song = song_optimizer . optimize ( song_to_generate , OPTIMIZED_PATTERN_LENGTH ) AudioEngine . new ( optimized_song , kit ) . write_to_file ( output_file_name ) end { duration : durations . last } end
Each pattern in the song will be split up into sub patterns that have at most this many steps.
Each pattern in the song will be split up into sub patterns that have at most this many steps .