lib/beats/song.rb
# Splits a Song object into multiple Song objects, where each new
# Song only has 1 track. For example, if a Song has 5 tracks, this will return
# a hash of 5 songs, each with one of the original Song's tracks.
Splits a Song object into multiple Song objects, where each new
Song only has 1 track. For example, if a Song has 5 tracks, this will return
a hash of 5 songs, each with one of the original Song's tracks.
Splits a Song object into multiple Song objects where each new Song only has 1 track . For example if a Song has 5 tracks this will return a hash of 5 songs each with one of the original Song ' s tracks .
def split
      split_songs = {}
      track_names = track_names()
      track_names.each do |track_name|
        new_song = copy_ignoring_patterns_and_flow
        @patterns.each do |pattern_name, original_pattern|
          if original_pattern.tracks.has_key?(track_name)
            new_track = original_pattern.tracks[track_name]
          else
            new_track = Track.new(track_name, Track::REST * original_pattern.step_count)
          end
          new_song.pattern(pattern_name, [new_track])
        end
        new_song.flow = @flow
        split_songs[track_name] = new_song
      end
      split_songs
    end
def split split_songs = { } track_names = track_names ( ) track_names . each do | track_name | new_song = copy_ignoring_patterns_and_flow @patterns . each do | pattern_name , original_pattern | if original_pattern . tracks . has_key? ( track_name ) new_track = original_pattern . tracks [ track_name ] else new_track = Track . new ( track_name , Track :: REST * original_pattern . step_count ) end new_song . pattern ( pattern_name , [ new_track ] ) end new_song . flow = @flow split_songs [ track_name ] = new_song end split_songs end
Splits a Song object into multiple Song objects, where each new
Song only has 1 track.
Splits a Song object into multiple Song objects where each new Song only has 1 track .